React is a popular JavaScript library that helps you build user interfaces for websites and apps. When starting a new project with React, you may wonder if you should use a framework or not. React just released its new documentation React Docs and the creators of React recommend using a framework, and in this article, we'll see why.
Framework
Frameworks are pre-built sets of tools and features that can help you build websites and apps faster and more efficiently. They provide features like routing (helping you move between different parts of your site or app), data fetching (helping you get data from a server), and generating HTML (helping your site or app load faster).
The Problem
While you can use React without a framework, building a project fully with React can lead to problems as your project grows. As you add more features, your JavaScript code can become larger, leading to slower load times. You may also need to figure out how to split code for every route individually or encounter server-client network waterfalls that make your app feel very slow. This is why Svelte has SvelteKit, Vue has Nuxt, and other frameworks exist to solve these problems.
The Solution
React frameworks solve these problems by default, with no extra work from your side. They let you start with a lean codebase and scale your app with your needs. Each React framework has a community, so finding answers to questions and upgrading tooling is easier. Frameworks also give structure to your code, helping you and others retain context and skills between different projects.
What if I still want to use CRA?
If you have unusual constraints that aren't served well by existing frameworks or you simply prefer to create your own custom setup, you can still use React without a framework. You can grab react
and react-dom
from npm, set up your custom build process with a bundler like Vite or Parcel, and add other tools as you need them for routing, static generation or server-side rendering, and more.
Conclution
In summary, while it's possible to use React without a framework, the creators of React recommend using a framework to solve common problems and make building your app or website faster and more efficient. Its time to say Goodbye to create-react-app
and start using Production-grade React frameworks like Next.js, Remix, Gatsby or Expo (for native apps).
Top comments (1)
Why not use vue.js
It's really comfortable to work with
It's easy, it flows
And we really don't need to work with nuxt