React - Js Cheat Sheet
React - Js Cheat Sheet
React - Js Cheat Sheet
js
Cheat Sheet
SWIPE
Basic concepts
JSX - JavaScript XML. Allows writing HTML structures
in JavaScript files using XML- like syntax.
KEEP SWIPING
Components
Functional components and class components
are two ways to build components in React,
each with its distinct characteristics:
Class Components: Before the introduction
of Hooks in React 16.8, this was the only way
to create components with state and access
lifecycle methods. They require using the
class keyword to extend
‘React.Component’ and offer a more
verbose syntax.
KEEP SWIPING
Components
Functional components: Initially used for
stateless components, the introduction of
Hooks has enabled the use of local state, side
effects, and other React features, making
functional components almost universally
preferred for their concise syntax and ease of
maintenance.
KEEP SWIPING
Creating Components
Functional components with State:
KEEP SWIPING
Class Component with State and Lifecycle
Methods :
KEEP SWIPING
Hooks
useState
useEffect
KEEP SWIPING
Hooks
useReducer
useCallback
KEEP SWIPING
Hooks
useMemo
useRef
useTransition
KEEP SWIPING
Conditional rendering
Inline if with Logical && Operator:
KEEP SWIPING
Lists and Keys
Rendering Multiple Components
Handling Events
KEEP SWIPING
Fragments
Used to group a list of children without adding
extra nodes to the DOM.
KEEP SWIPING
Forwarding Refs
Used to pass reft down to child components.
KEEP SWIPING
This cheatsheet covers foundational concepts and
common hooks in React development, and its beginner
friendly.
Remember, React and its ecosystem are vast, and
continuous learning and practice are key to mastering it.
Don`t forget to
leave a .
Happy coding!
COMMENT BELOW