3 ms·
React is arguably just a library though. NextJS is React as a framework
by quickthrower2 3y ago
React is arguably just a library though. NextJS is React as a framework
- hot_gril 3y agoReact: - completely changes how you write your frontend - changes the language itself (JS -> JSX with embedded HTML) - has lots of react-* libs built around it - comes with a script initializing an app skeleton I would call that a framework. And it's a very good one.
- mostlylurks 3y ago> completely changes how you write your frontend You can use it for only a part of your UI, and you can implement any parts of your UI that are embedded within react components without react as well. It doesn't lock you into doing things its way in any manner whatsoever, it is literally just a library with functionality that you can utilize wherever relevant in your app. > completely changes how you write your frontend JSX is not an integral part of react. It's quite feasible to use react without using JSX, and I have done so in the past in some of my side projects when I wanted to avoid setting up a build system for a while. JSX just compiles down to plain old function calls, and you can use those directly without JSX without any issues. > (JS -> JSX with embedded HTML) JSX doesn't really have embedded HTML, it's just syntactic sugar for plain function calls that only somewhat approximates HTML. > has lots of react-* libs built around it Which are usually either libs that implement a react component with react or just wrap some non-react library in a way that's slightly easier to use than using the library directly in an app using react, but it's not like that latter is impossible or even difficult. > comes with a script initializing an app skeleton Such scripts exist, but they are not integral parts of react and are by no means required to use react. React is just a library, and if you want to, you can use it without doing anything else except including a single .js file with a <script> in your html file, even if the more usual way of including react in your project is a lot more convoluted.
- hot_gril 3y agoYes, you can use React not like a framework, but very few people do that. If you say you're using React, it's assumed you're doing it the usual way (with JSX and all).
- Drew_ 3y agoYou're conflating React the library with create-react-app which is a collection of pre-configured tooling for making SPAs. React on it's own is very much just a library with a couple functions.
- manquer 3y agofactory to build a factory I see . Most including the standard docs would recommend using create-react-app unless you really know what you are doing
- mostlylurks 3y agoPart of that is almost certainly because it is far, far easier to explain how to get started with create-react-app then it would be to explain the various alternative approaches, especially considering how inexperienced on average the kind of people who are looking up how to set up a react project must be (professional developers needing the information for their actual work probably constitute a small minority), even if those alternative approaches themselves are not complicated at all to those who have the prerequisite knowledge to understand how a library like react would be incorporated into their particular setup.
- xigoi 3y agoWhat's hard to explain about “add this <script> tag to your HTML, open a new JavaScript file and start writing”?
- hot_gril 3y agoIt's not that simple if you want JSX. https://legacy.reactjs.org/docs/add-react-to-a-website.html#optional-try-react-with-jsx https://legacy.reactjs.org/docs/add-react-to-a-website.html#... if this is up to date
- BigJono 3y agoThe standard docs can go fuck themselves. I've never seen a community try and fuck up a good library as hard as the React community does. React itself is great. Almost everything built on top of it and every word spoken about it on the internet is garbage. The incessent focus on shit like CRA, NextJS and people shitting themselves over "NIH" is going to kill React in the next decade and we're going to be stuck with something 10x shittier in it's place. Well done team!
- Camisa 3y agoSure, to me a library is something you call, like ReactDOM.render(), React.useState(), etc, and a framework calls the code you create. You create files and modules for a framework in the way that it dictates, and a library doesn't constrict you in any way. But defining react as a framework or a library isn't easy, the word "React" isn't just one thing. JSX, initializing script, and the app skeleton are all optional to using React, yet React without JSX doesn't exist, everyone does it, like bundling your web app is a must in production nowadays. React wasn't so much a framework when it started, you could add pieces of react in different parts of your page, to the point people sometimes argued that it was overkill to have the entire page be a react app. It is slowly walking into the framework direction, and the new react.dev docs violently suggest you use a react with a framework. A developer doesn't just "start" using react in these times, they need to understand a lot to create a full project with react.
- hot_gril 3y agoOh, this is new to me. It's not recommending create-react-app, it wants me to use Next.js or something. Yeah that seems like a bit much. I was even doing a React project recently and went straight to create-react-app, bypassing all this, haha.