---
# System prepended metadata

title: React Basic

---

# React Basic

React is a JavaScript library for building User Interfaces.

For example, say you're building an e-commerce website and you'd like to maintain the number of items in the shopping bag as the user adds and removes items. React makes it easier for you to specify that you'd like to show the number of items in the shopping bag: {items.length}.
React will display that (the number of items in the shopping bag) but also update it whenever it changes.

React is NOT a framework
React is a library and not a framework.
The difference between a library and a framework is that a library only helps you in one aspect whereas a framework helps you in many aspects. Let's take an example:

React is a library because it only takes care of your UI.
Angular, on the other hand, is a framework because it handles much more than the UI (It handles Dependency Injection, CSS encapsulation, etc.)


1-Install react with npm install react
2-Import React in every file you need it with import React from "react"
3-Get the current React version with React.version
4-React weighs 12.5KB when imported.

#Note : React.createElement returns a React Element
#Note : React.createElement(type, options, children)

