Is React.js a framework or a toolkit?

Technically React is a toolkit that you can utilize as a framework. React is a toolkit and not a framework because React has very few opinions about how you should construct applications. Typically you would expect a framework to provide structure and standard practices for building your web applications.

Commonly React is often referred to as a framework.

Examples of frameworks that are often compared to React are Angular and Vue. These tools have clear core ideas about how you should build a web application and provide opinionated tooling to accomplish that.

With React, the core is a very optimized and low-opinion tool.

This is the reason you see meta-frameworks like Next.js and Gatsby built on top of React that provide more opinionated approaches to developing applications and tooling to support those opinions.

Additionally there are several UI frameworks that provide an opinionated visual design and component layer on top of React, such as Material UI or reactstrap (a React implementation of Bootstrap 4).

Because of React's low-opinion nature, you are provided with a lot of flexibility and choice when it comes to building your web applications. When you are learning to React this new decision making layer can often feel overwhelming. Unfortunately for many, that feeling doesn't go away entirely as you gain experience.

When building web applications with React, one thing to keep in mind is that if you aren't using a framework, you are often creating a framework! 😅