Getting Started With React
React was created by Jordan Walke, a software Engineer at Facebook for building user interfaces. React is influenced by XHP which is a simple HTML component framework for PHP. React was basically in its beta mode at Facebook, until Instagram adopted it for their system. Overtime, React grew and Facebook made it open source in May of 2013. With React, a developer can design simple views for each state in the application, and it will update and render the component when the data changes. React is also very useful for protecting internal components or data flows.
Subcomponents cannot be affected with external queries, making it a great alternative for front end user interface development.
The library also ensures that there is a clear distinction between the different components, ensuring easy upgrades and maintenance. Components in React implement a render() function, which takes in some input data and returns to display. The implementation uses an XML-like syntax called JSX. The render() function can access the passed in data via this.props. In react, a state is an object that holds some information that has the possibility to change over time. Props are data passed down from a parent to a child component. To get started with creating your first React app simply run these commands in you terminal:
npx create-react-app my-app
Once, you have your app created, then to start making Class Components the basic outline is:
If most of your components are going to be presentational then you might want to use Functional Components:
Here’s an image explaining the difference between the two:
Now you’ll be well on your way to creating amazing React applications! Happy Coding!