How to use other open source libraries in a Next.js project?
Unanswered
German Pinscher posted this in #help-forum
German PinscherOP
I am a beginner in Next.js and I have no idea about the common practices of Next.js development.
I want to use libraries like PDF.js, echarts, ToastUICalender, etc., which can manipulate HTML elements based on their IDs.
Am I going in the right direction? Please advise me!
I want to use libraries like PDF.js, echarts, ToastUICalender, etc., which can manipulate HTML elements based on their IDs.
Am I going in the right direction? Please advise me!
9 Replies
Aleutian Tern
You could use all these libraries on nextjs/react, you'll need to use "useEffect" as a escape hatch to access the DOM, isn't "wrong" per say". But I recommend you to try to find React alternatives of theses libraries/whatever feature you want. Exploit the mature react ecosystem and you'll need to do less work.
German PinscherOP
Thank you for your comment! I understood what you said, and now I can try Next.js without a doubt.
How do you find these React libraries? Is GitHub the best way to discover them, or are there portal sites like PyPI?
How do you find these React libraries? Is GitHub the best way to discover them, or are there portal sites like PyPI?
Aleutian Tern
Well you'll probably always find something researching "{Some feature} React", I check if the package is up-to-date/healthy community, you can also compare the package with alternatives using: https://npmtrends.com/
Take a step back and do some tutorials on JavaScript, NodeJS and NPM
Before diving into nextjs
The questions you’re asking are generic to JavaScript development and are essential to understand
If you don’t know the answer to them then you’re basically just going to be blindly trying things and hoping it works.
I believe he doesn't know how to use libraries that directly affect the dom elements using IDs and such.
So its more like his question is how to use libraries like echarts with react.
(Echarts latches on to an element using its ID iirc)
So its more like his question is how to use libraries like echarts with react.
(Echarts latches on to an element using its ID iirc)
German PinscherOP
Thank you for your comments!
Indeed, I was looking for guidance on how to use such libraries in Next.js. I've also come to realize that I need to revisit Node.js and NPM tutorials.
Indeed, I was looking for guidance on how to use such libraries in Next.js. I've also come to realize that I need to revisit Node.js and NPM tutorials.