Reactsjs Note
Reactsjs Note
Structure:
JSX elements are written using opening and closing tags, similar to HTML elements. However,
JSX elements can contain both HTML-like attributes and JavaScript expressions enclosed in
curly braces {}.
React Components
What are React Components?
Components are the building blocks of React applications.
They encapsulate reusable pieces of UI, allowing you to split the UI into independent, reusable
pieces, and think about each piece in isolation.
Key Concepts:
React Router
React Router is a popular library for managing navigation within React applications. It provides
a declarative way to define routes, handle URL changes, and render components based on the
current URL.
REACT HOOKS
React Hooks were introduced in React 16.8 as a way to add state and other functionalities to
functional components. They provide a more concise and easier-to-understand alternative to
traditional class-based components with lifecycle methods. Examples are usestate, useeffect,
useContext, useRef etc.
Rules of Hooks:
1. Hooks should only be called at the top level of a functional component or custom hook.
2. They should not be called conditionally or in nested functions.
3. Hooks should be called in the same order in every render of a component.