React (also known as React.js or ReactJS) is a JavaScript library for building user interfaces. It uses a declarative paradigm and aims to be both efficient and flexible.
React is a JavaScript library for building user interfaces.
It uses a declarative paradigm that makes it easier to reason about your application and aims to be both efficient and flexible. Initially developed internally at Facebook, React has since been made open source where it continues to be developed and maintained by Facebook and the open source community.
Just the UI
Lots of people use React as the V in MVC. React makes no assumptions about the rest of your technology stack, and it's easy to try it out on a small feature in an existing project.
Virtual DOM
React uses a virtual DOM diff implementation for ultra-high performance. It can also render on the server using Node.js — a heavy browser DOM isn't required. Further, there is a React-Native offshoot for using React on mobile devices such as ios and Android.
Data flow
React implements one-way reactive data flow using props which reduce boilerplate and is easier to understand than traditional two-way data binding.
Example using JSX
class HelloWorldWidget extends React.Component {
render() {
return (
<div>
Hello World!
</div>
);
}
};
ReactDOM.render(
<HelloWorldWidget />,
document.body
);
Advantages
React creates a virtual DOM so that all the components can be re-rendered individually without the need for the whole page to be repainted by the browser
A user can update a particular content of the page just by re-rendering only that component
React's view logic means it can easily render on the server, in the browser or native components
React can be used in conjunction with frameworks like Angular.js and Backbone.js
Separating the declarative view (JSX) and logic make projects easier to read and maintain
Resources:
- Official website
- Getting started
- Awesome React
- JSX Specification
- React conference 2015 videos
- React conference 2016 videos
- React conference 2017 videos
- React conference 2018 videos
- CodeSandbox Playground
- React Discuss
- Reactiflux on Discord
- ReactJS Program
- TypeScript-React-Starter
Books:
- React.js Essentials
- Mastering React
- ReactJS by Example - Building Modern Web Applications with React
- The Road to learn React
- Fullstack React: The Complete Guide to ReactJS and Friends