๐๐ฎ๐ ๐ด๐ฌ - ๐๐ฟ๐ฒ๐ฎ๐๐ถ๐ป๐ด & ๐ฅ๐ฒ๐ป๐ฑ๐ฒ๐ฟ๐ถ๐ป๐ด ๐ฅ๐ฒ๐ฎ๐ฐ๐ ๐๐ผ๐บ๐ฝ๐ผ๐ป๐ฒ๐ป๐๐
React components are the building blocks of any React application. Components allow you to split the UI into independent, reusable pieces, and think about each piece in isolation. There are two main types of components in React: functional and class-based components.
Component Types
- Functional Component: Functional components are simple JavaScript functions that return JSX (the UI structure). Since the release of React hooks, theyโve become the go-to method for creating components.
- Class Component: Class components are older and more verbose than functional components. They were widely used before hooks were introduced. A class component extends
React.Component
and requires arender()
method to return JSX.
To render a React component, use the ReactDOM.render()
method to render components to the DOM. In index.js