Introduction to react

Introduction to react

ReactJS is a declarative library used for building dynamic projects. I mentioned projects because it is not only limited to websites, it also includes functions for creating native applications among others. It helps you to build composable user interfaces.

React was developed by Facebook in 2013 and has been powering large scalable applications since then and has also seen massive transformation which indicates that the project has been growing.

React has achieved massive success since it's inception and friendly learning curve, it's learning curve is one to enjoy with it's intuitive namings and capabilities. Migration from other frameworks is also easy because it follows and breaks down standard patterns for easy use. It is also a feature rich system that takes the pain from web development and guides with a solid mental framework.

React uses the declarative approach in building projects and helps you understand javascript better. Concepts like immutability is heavily emphasized on in react which simply means a state of being unable to change data types used within the project, since it follows the declarative approach, your data has to be redeclared, going against this rule is going against the belief of react and how it was built.

React was first introduced with react factories where every element was manually created with factories and react.createElement()

The process of creating an h1 element followed this kind of pattern :

React.createElement("h1",{id:'reactnode', 'data-node':'new-concept'},"Welcome to 
 React");
<h1 id='reactnode' data-node='new-concept'>Welcome to React</h1>

This process was actually strenous, imagine writing a full website with this method. Painful, yea?

The process of writing react was then improved with the introduction of components where a project was composed of different components written with JSX. This components were created using classes but it also had it's limitations like embedding states among others before we were introduced to functional react. Functional react was a method of creating stateless components with functions which accompanied the introduction of hooks to inject state among other hooks to different components.

How to install react

React is a JS library and requires tools to run which includes :

  • Node
  • NPM React provides a package to successfully create a react app. Navigate to your terminal and run npx create-react-app my-app After successfully running the command, cd to the project by running cd my-app Then you can run npm start

Hooray, you have successfully created your first react app.

You can familiarize yourself with react by checking the docs. There is a recommended beta docs at reactdocs which simplifies the documentation. There is also the olderdocs which also contains some concepts not yet explained in the new docs.

Kindly drop your feedbacks and concepts you want me to explain in the comments.