Some important topics in React
Components: Components are building of blocks in react app. There can be many components in one react app. It’s an independent and bits of code which is reusable. While creating a react app the components must be start with uppercase letter.
Types: There are 2 types of react components. They are -
(i) Class component: This component have to include extends React.Component statement. this statement create an inheritance to React.Component and gives your component an access to your React.Component’s function . This function requires an render() method which returns HTML. Example:
(ii) Function Component : This component is pretty much same behavior like class component but here in this component there are function instead of classes. It also returns HTML . Example:
Props: Props is a special keyword which is the short form of properties. props are passed as arguments from one component to another. It’s data is only read only which means it only can be received from parent component but can’t be changed by child component. Example-