React.js
CHEAT SHEET
Eve!ones
Basic Concepts
RTS aoe ele ort tee ee ROUT Ren een ate ee eee] a RSI
Secu acons
a eee te ate ce totem ere earns
eee re)
Props - Short for properties, these are read-only inputs to components that
Cinema Mc oMmeiie Viceltielg!
SC Cem aun Reuse RN a Rec a
Used in class components and functional components via the useState
ielelg
Cy Uy
ae oteUal eaRe Ke nee SR ort
components in React, each with its distinct characteristics:
Piolo Mer tual Sale ele ag get aged Ma Cota
rere Molaro ACM tlie sola RL ere Rete na
aC Rae Rao Rec iar)
PTrelaner tal melee mele Ty eee sialon’
Le ed
class Welcome extends React .Component
render
return
Adee ae Mee IAIN edeon vo @
Seti Rein casa ae ee elmer earns)
(presentational components), the introduction of Hooks has enabled the
use of local state, side effects, and other React features, making
EMinrersorarel Rela Solstice del untecia ia courted a edcecie et Acclm atm ecelatel
Macrae hte mel cules
function Welcome( props
iacad ia ved props. name}
PR eRe eo ee ee Rel Ra ctelra ort Ne Reals) econ)
RVs emanate ea ea anaes Selene ec Romar
Aalel mentee acs enec
Creating Components
* Functional Component with State:
eee
RO ieee
function Counter
const [count, setCount) = useState(
asta)
penne
otis i
allel <3)
Bt) fC)
ize)
Cac ceem eae cy
this. state
env @
eae aS* useEffect
Pets aa clad od
Croat
CO uae y
* useContext
ie)
const value = useContext(MyContext
Oar Let
Cr)
Cae TM he eee ol eae te
Pert tore Tefal
fea
const memoizedCallback = useCallback.
Cerca
eon vo @
SCS Ue mabeenv @
* useMemo
id
Con acu ect ems ee essary te ee
Ss
xe
ors aT eT Re INV VET
Carus}
const [isPending, startTransition] = useTransition
Conditional Rendering
Inline If with Logical && Operator:
Reon eu nea ucnd i)
TM et RU exits sola ke) ks Oo
| {condition ? «Componenti /> : }ones
SE CZ
Rendering Multiple Components
eee
orc MUMS pee ea eR UC Rc
Handling Events
ie