If you're familiar with class components then you might know that we have various lifecycle methods but in functional components, we don't have any lifecycle methods. Instead we have a powerful hook called useEffect
React Hooks are the functions which "hook into" React state and lifecycle features from function components. Hooks allows you to manipulate state and other React feature without writing a class. Let's talk about widely used hook
useEffect hook at a glance 🧵👇🏻
If you're familiar with class components then you might know that we have various lifecycle methods but in functional components, we don't have any lifecycle methods. Instead we have a powerful hook called useEffect
So let's start by understanding the syntax first
3/15
The function inside the useEffect will run every single time component re-render. Consider this piece of code and check the output in next tweet
{ 4 / 15 }
{ 5 / 15 }
For example, let me modify the code little bit so that you can understand it better
{ 6 / 15 }
{ 7 / 15 }
No matter how many times you render your component, the useEffect will run only once because the value of empty array never going to change
{ 8 / 15 }
If we return a function within the method, this function perform basically a clean up of what we did last time.
{ 9 / 15 }
useEffect(() => {
console.log({ render });
return () => {
console.log("I'm cleanup function");
};
}, [render]);
Everytime I click the button, first our useEffect perform clean up then run the effect function
10/15
Let's build something useful using it. We will be using useEffect for fetching some COVID data
{ 11 / 15 }
On the basis of the value entered by user we will store that in "country" and change that value in our API link
{ 12 / 15 }
- on form submit, store the input value in "country"
Print the confirmed cases on screen as simple as that
check the entire code
{ 13 / 15 }
More from Pratham
7 amazing websites that will help you improve your CSS skills
🧵👇
1️⃣ Learn to code HTML and CSS
- Learn how to build beautiful and intuitive websites by way of clear and organized lessons
🖇️ https://t.co/bl2rx2q8vk
2️⃣ CSS reference
- CSS Reference is a free visual guide to CSS. It features the most popular properties, and explains them with illustrated and animated content
🖇️ https://t.co/XAlj33g1Zk
3️⃣ CSS tutorial
- These tutorials on web design & CSS makes learning this stuff fun and easy
🖇️ https://t.co/y9vAj6fMGk
4️⃣ CSS Layouts
- This site teaches the CSS fundamentals that are used in any website's layout.
🖇️ https://t.co/n4EGLScpDF
🧵👇
1️⃣ Learn to code HTML and CSS
- Learn how to build beautiful and intuitive websites by way of clear and organized lessons
🖇️ https://t.co/bl2rx2q8vk
2️⃣ CSS reference
- CSS Reference is a free visual guide to CSS. It features the most popular properties, and explains them with illustrated and animated content
🖇️ https://t.co/XAlj33g1Zk
3️⃣ CSS tutorial
- These tutorials on web design & CSS makes learning this stuff fun and easy
🖇️ https://t.co/y9vAj6fMGk
4️⃣ CSS Layouts
- This site teaches the CSS fundamentals that are used in any website's layout.
🖇️ https://t.co/n4EGLScpDF
7 GitHub repositories will make you a standout developer from 99% of people:
1. Memphis
An open-source real-time data processing platform.
• Message broker
• Schema Management
• Zero ops
• Cloud-native
• Rapid development
• Significantly lower development time
🔗 https://t.co/w5L2aCM3do
2. The art of command line
Master the command line, in one page.
🔗 https://t.co/uF2RlcUIxb
3. Public APIs
A collective list of free APIs for use in software and web development
🔗 https://t.co/vDRQKBf15V
4. Hover
A collection of CSS3 powered hover effects to be applied to links, buttons, logos, SVG, featured images and so on.
🔗 https://t.co/bIGEEPcMkJ
1. Memphis
An open-source real-time data processing platform.
• Message broker
• Schema Management
• Zero ops
• Cloud-native
• Rapid development
• Significantly lower development time
🔗 https://t.co/w5L2aCM3do
2. The art of command line
Master the command line, in one page.
🔗 https://t.co/uF2RlcUIxb
3. Public APIs
A collective list of free APIs for use in software and web development
🔗 https://t.co/vDRQKBf15V
4. Hover
A collection of CSS3 powered hover effects to be applied to links, buttons, logos, SVG, featured images and so on.
🔗 https://t.co/bIGEEPcMkJ
JavaScript is powerful.
But sometimes, you can do great things using CSS.
A long thread of CSS tips and tricks:
1. Smooth
2. Change marker styling
3. Add styling to video
4. Change input caret
But sometimes, you can do great things using CSS.
A long thread of CSS tips and tricks:
1. Smooth
CSS Tip\U0001f4a1
— Pratham (@Prathkum) February 11, 2021
Enable smooth scrolling for the whole page\U0001f447 pic.twitter.com/E7QERt6V3Y
2. Change marker styling
3. Add styling to video
CSS Pro Tip \U0001f3a8
— Pratham (@Prathkum) April 11, 2021
You can style the subtitles of video on your website using ::cue pseudo-element pic.twitter.com/fV56PmxkX7
4. Change input caret
CSS tip\U0001f3a8
— Pratham (@Prathkum) February 23, 2021
You can change the input caret color using CSS\U0001f447
\u27b8 The\xa0caret\xa0is typically a thin vertical line that flashes to help the text area more noticeable pic.twitter.com/VA0paD7d2a
More from Webdev
6 beginner friendly websites that will boost your HTML and CSS learning process 🚀
🧵👇🏻
1️⃣ Learn HTML
- The easiest way to learn HTML & CSS. Learn HTML provides an interactive tutorial that explains how to build HTML & CSS websites step by step.
🔗 https://t.co/W1XytKL1MI
2️⃣ HTML best practice
- A very well written document on HTML best practice
🔗 https://t.co/6PTcY1U5Cw
3️⃣ Learn to Code HTML & CSS
- Learn to Code HTML & CSS is a simple and comprehensive guide dedicated to helping beginners learn HTML and CSS
🔗 https://t.co/LwY9E2qUNS
4️⃣ Hex Invaders
- Hex Invaders is a fun way to learn and understand what hex codes are and how they work
🔗 https://t.co/EpQyhlN7pv
🧵👇🏻
1️⃣ Learn HTML
- The easiest way to learn HTML & CSS. Learn HTML provides an interactive tutorial that explains how to build HTML & CSS websites step by step.
🔗 https://t.co/W1XytKL1MI
2️⃣ HTML best practice
- A very well written document on HTML best practice
🔗 https://t.co/6PTcY1U5Cw
3️⃣ Learn to Code HTML & CSS
- Learn to Code HTML & CSS is a simple and comprehensive guide dedicated to helping beginners learn HTML and CSS
🔗 https://t.co/LwY9E2qUNS
4️⃣ Hex Invaders
- Hex Invaders is a fun way to learn and understand what hex codes are and how they work
🔗 https://t.co/EpQyhlN7pv
You May Also Like
So friends here is the thread on the recommended pathway for new entrants in the stock market.
Here I will share what I believe are essentials for anybody who is interested in stock markets and the resources to learn them, its from my experience and by no means exhaustive..
First the very basic : The Dow theory, Everybody must have basic understanding of it and must learn to observe High Highs, Higher Lows, Lower Highs and Lowers lows on charts and their
Even those who are more inclined towards fundamental side can also benefit from Dow theory, as it can hint start & end of Bull/Bear runs thereby indication entry and exits.
Next basic is Wyckoff's Theory. It tells how accumulation and distribution happens with regularity and how the market actually
Dow theory is old but
Here I will share what I believe are essentials for anybody who is interested in stock markets and the resources to learn them, its from my experience and by no means exhaustive..
First the very basic : The Dow theory, Everybody must have basic understanding of it and must learn to observe High Highs, Higher Lows, Lower Highs and Lowers lows on charts and their
Even those who are more inclined towards fundamental side can also benefit from Dow theory, as it can hint start & end of Bull/Bear runs thereby indication entry and exits.
Next basic is Wyckoff's Theory. It tells how accumulation and distribution happens with regularity and how the market actually
Dow theory is old but
Old is Gold....
— Professor (@DillikiBiili) January 23, 2020
this Bharti Airtel chart is a true copy of the Wyckoff Pattern propounded in 1931....... pic.twitter.com/tQ1PNebq7d
On the occasion of youtube 20k and Twitter 70k members
A small tribute/gift to members
Screeners
technical screeners - intraday and positional both
before proceeding - i have helped you , can i ask you so that it can help someone else too
thank you
positional one
run - find #stock - draw chart - find levels
1- Stocks closing daily 2% up from 5 days
https://t.co/gTZrYY3Nht
2- Weekly breakout
https://t.co/1f4ahEolYB
3- Breakouts in short term
https://t.co/BI4h0CdgO2
4- Bullish from last 5
intraday screeners
5- 15 minute Stock Breakouts
https://t.co/9eAo82iuNv
6- Intraday Buying seen in the past 15 minutes
https://t.co/XqAJKhLB5G
7- Stocks trading near day's high on 5 min chart with volume BO intraday
https://t.co/flHmm6QXmo
Thank you
A small tribute/gift to members
Screeners
technical screeners - intraday and positional both
before proceeding - i have helped you , can i ask you so that it can help someone else too
thank you
positional one
run - find #stock - draw chart - find levels
1- Stocks closing daily 2% up from 5 days
https://t.co/gTZrYY3Nht
2- Weekly breakout
https://t.co/1f4ahEolYB
3- Breakouts in short term
https://t.co/BI4h0CdgO2
4- Bullish from last 5
intraday screeners
5- 15 minute Stock Breakouts
https://t.co/9eAo82iuNv
6- Intraday Buying seen in the past 15 minutes
https://t.co/XqAJKhLB5G
7- Stocks trading near day's high on 5 min chart with volume BO intraday
https://t.co/flHmm6QXmo
Thank you