Skip to content

Instantly share code, notes, and snippets.

@dispix dispix/useUpdate.js
Created Oct 29, 2018

What would you like to do?
import { useRef, useEffect } from 'react'
function useUpdate(fn) {
const mounting = useRef(true)
useEffect(() => {
if (mounting.current) {
mounting.current = false
} else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.