React cheatsheet

Published 3 months ago: October 27, 2020


React cheatsheet

This cheatsheet is a small collection of handy snippets for quick reference in tricky situations. Feel free to suggest edits, propose additions, complain about something, disagree with content or such and the like. Every feedback is a welcome one.

Run function on component render

import React, { useEffect } from "react"

useEffect(() => {
    console.log('This runs on every render')
})

// add and empty array as a callback to run once, instead of on every render
useEffect(() => {
    console.log('This runs exactly once')
}, [])

Christoffer Lybekk

Developer under development

Explore more articles with similar tags

ReactJavascriptCheatsheet

Article stats


5words

1sentences

1paragraphs

1 minread time