#30DaysofReact #Day6
React.js
React is a JavaScript framework which abstracts the view layer of an application. When using React you split up your application in lots of smaller components. A component consists of event handling, styling and sometimes state. This makes a component an isolated and reusable piece. These components can be combined into larger components.
Reacts markup language JSX:- React components are written in a markup language called JSX (JavaScriptXML), an XML/HTML like structure. By default the JSX code cannot be parsed by the JavaScript runtime. This is where transpilation comes in. To run the JSX code the code is first transpiled using Babel. This basically means to restructure the code from format A to format B.
Working with state Every React component can contain state. In the most basic form state is just an object which lives inside a component.The idea is that every time the state within the component changes, the component will re-render using this new state. The diffing algorithm then decides which parts of the component needs updating. An example of state in a component can be a simple increment. Every time the setState is called the component will re-render. When your application grows larger and larger you might want to look into a more robust state management system such as Redux.