I’m playing around with the new NPM and I wanted to understand the best usecases for NPM vs creating custom components.
I am planning to implement the following which is a audio visualizer: UNPKG - wavesurfer
What I’m trying to understand better is in what case it’s better to use something like NPM or creating a custom component.
In the case it’s possible to use the NPM install, is someone able to help me with the steps? I seem to not be able to load wavesurfer visually in the editor.
The only unpratical thing is managing the lifecycle of the component (eg. destroy the created wavesurfer instance when the section is unmounted in the page), that is better handled with a custom component.
It so strange, I tried replicating the exact same thing, but I dont get the wavelenght, its usually just blank, sometimes I get just a black line in the middle of the screen. I tried multiple other methods as well as audios.
There are a lot of possible things that can generate errors.
Do you have a valid url pointing to a valid file?
When are you triggering the logic? Is your container already rendered in the page when you trigger the logic?
Try opening the browser dev tools and look for errors in the console, maybe there is an error logged there
You can see from the screenshot above that the black line I was talking about shows up. (Not related to container with hight as I have tried a few things on this as well).
is 100% of the parent’s width, so it depends on the parent as well.
every time I have bugs and can’t fix them in place I try to reproduce a minimal example on an empty page, just to check if it is a problem specific with the page or if it is something in the component itself. try to see if you can make it work in a minimal example.