i'm currently expolring ReactJS i saw NextJS and React Router
Can anyone tell me what's the pro cons between the two. I'm not sure if it's right to compare the two, but from what i see, react-router already has SSR feature. So whats the benefit of using NextJS?
Thanks!
In React JS, we would install a package called react-router-dom to implement routing inside the application. But Next JS has its own inbuilt router from the next/link , with which we can navigate between the pages. Before using the next/link , we need to set up the different pages/routes inside the pages folder.
Next JS is a framework that holds React on its base, while React JS is an open-source JavaScript library, developed and maintained by Facebook. Next JS is used to create web applications and performs server-side rendering, whereas React JS focuses on rendering towards the DOM.
It's easy to code - compared to React itself and other frameworks working with React, Next. js requires less code. Developers just have to create the page and link to the component in the header, which means less code, better readability, and improved project management. Speed - Applications built with Next.
js developer has to know React, every React developer has to know JavaScript, as those are pieces built on top of each other and there's no way to use React without JavaScript, and there's no way to use Next. js without React, so there's no way of Next.
Next.js (see also alternatives like GatsbyJS and After.js) are full featured SSR/static site frameworks, so you get a lot of features out of the box if you need to generate a SSR static site. These frameworks have solved lots of problems, so adding a feature becomes as simple as reading the docs, rather than researching and coding on your own.
If you code your own setup with a standard React app and react-router then you might find yourself running into a lot of complexity and edge cases when you dig into SSR.
In short, if SSR is a core requirement definitely consider using a SSR React framework.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With