React - the interesting things and articles
First step is getting to know React docs, and taking the learnings from there: https://react.dev/learn
Basics od how react works: https://medium.com/@ruchivora16/react-how-react-works-under-the-hood-9b621ee69fb5
Hooks
useState
Useful for holding variables used in components. Triggeres rerenders of components.
const [count, useCount] = useState(0)
useRef
When you want to reference a value that is not needed for renders. Changeof ref does not triger componnet re-render. You access it and mutate with .current property. Useful for holding values for example in the same function before render occurs.
const count = useRef(0)
console.log(count.current)
useEffect
Used to trigger side effects. For example when a value changes. Runs always on initial render. In dependency array there are variables that change triggers the hook. You can return cleanup function in those, that is run always before it's called again.
useMemo
Allow for memoizing values between renders, and not run when not needed. Dependency array decides when it's triggered.