What is component
Component are the independent and reusable of code They serve the same purpose as Js function but work in isolation and return in Html
1 First letter will be uppercase rest will be lower case
2 component return the jsx
Rule of Jsx
- jsx return parent component
- jsx element must be closed
- jsx attribute using camelcase example=(They used className not class)
Expression in jsx
In the jsx you can write the expression in curely bracket the expression can be react variable and value jsx expression return in the result
What is props
Props are the arguement pass the React component
Props allow data pass the parent comp. to child comp.
Condition rendering
condition rendering allow to dynamically display different ui comp. on specific condtion
What is state
State is way to store and manage the data that change can overtime and affect the how the comp. render
we can define the state using useState Hook which allow to setinitial value and function to changed the value
What is Portal
Portal is feature the allow the render a child component into a dom that exits the outside of the parent compon.
example modal ,tooltip,dropdown
useEffect
useEffect hook allow side effect in your component
fetching the date
update the dome
some point
without array on every single render
empty array first initial render
emty array have some value if value changed the he render
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.