React hooks #6 React Course | Code with Sloba
React hooks are a way for your function components to “hook” into React’s lifecycle and state.
React hooks were introduced in Reactjs 16.8.
But you must be thinking why the heck do I need hooks when I can do everything in the class component as well?
The core of Reactjs is the ability to break down complexity into smaller pieces.
However, we often can’t break complex components down any further because the logic is stateful and can’t be extracted to a function or another component.
This is solved with hooks and hooks let you always use functions instead of having to constantly switch between functions, classes, higher-order components, and render props.
Apart from that, react hooks cut your code like diet cuts fat, make your code slimmer, more concise, and more readable.
So hooks in React are recommended over class components, but that doesn’t mean that you should rewrite your old class components. So don’t sweat.
0:00 Intro
0:10 Why should we use hooks?
0:55 Types of hooks in Reactjs?
1:07 useState hook
2:27 useEffect hook
4:20 rules of hooks
************************************************************
Previous Video: • Managing state in React #5 React Cour...
Next video: • Handling Events In React #7 React Course
Full series: • Full React Course
************************************************************
🧿 I discussed:
✔️ What are Reactjs hooks?
✔️ Why do we use hooks in Reactjs?
✔️ What is the preferred way of components in React?
✔️ How to use useState hook in Reactjs?
✔️ How to use useEffect hook in Reactjs?
Social Media
**********************************
👉 Linkedin:
✔️ / slobodan-gajic
👉 Portfolio:
✔️https://bobangajicsm.github.io/portfo...
👉 Twitter:
✔️ / _slobodangajic_