Pluralsight has lot of High Quality Developement Videos
π¨βπ» By Google Chrome Developers
π¨βπ» By Rajat S
9 Useful Tips for writing better code in React: Learn about Linting, propTypes, PureComponent and more.
Know when to make new components
Component vs PureComponent vs Stateless Functional Component
π¨βπ» By Indrek Lasn
useState and useEffect Simple Example
With useEffect
, you can handle lifecycle events directly inside function components. Namely, three of them: componentDidMount
, componentDidUpdate
, and componentWillUnmount
.
Stackblitz Example of useEffect() render and unmount
Cleanup function you can (optionally) return from useEffect
isnβt only called when the component is unmounted. Itβs called every time before that effect runs β to clean up from the last run. This is actually more powerful than the componentWillUnmount
lifecycle because it lets you run a side effect before and after every render, if you need to.
Another way to think of this array: it should contain every variable that the effect function uses from the surrounding scope. So if it uses a prop? That goes in the array. If it uses a piece of state? That goes in the array.
It will print βmountedβ after the initial render, remain silent throughout its life, and print βunmountingβ¦β on its way out.
This comes with a big warning, though: passing the empty array is prone to bugs. Itβs easy to forget to add an item to it if you add a dependency, and if you miss a dependency, then that value will be stale the next time useEffect runs and it might cause some strange problems.
Remember that useState
is stateful (read more about useState). It only uses the initial state once, the first time it renders. After that itβs ignored. So itβs safe to pass a transient value, like a prop that might change or some other variable.
π¨βπ» By Brian Neville-OβNeill
querySelector
- Note that querySelectorAll
returns a NodeList
while $$
returns an array
.$(".some-class"); // instead of document.querySelector
$$(".some-class"); // instead of document.querySelectorAll
$0
. After inspecting an element you can access it in the console by typing $0
.console.table()
- Gets the logs of Array or Objects in a table.console.dir()
- This method will let you log the javascript object of a DOM element instead of its HTML.document.designMode = 'on'
- edit the text of any webpage.π¨βπ» By Mustapha
Chapter 9 Done