/
githubmirror
/
react-beautiful-dnd
Обзор
Документация
Войти
/
githubmirror
/
react-beautiful-dnd
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/view/use-previous-ref.js
14 строк
315 B
Bogdan Chadkin
Remove custom ExpectError from source code (#1294)
08 май 2019, 03:11
08 май 2019, 03:11
ea4270a
Код
Авторство
О чём код?
// @flow import { useRef, useEffect } from 'react'; export default function usePrevious<T>(current: T): {| current: T |} { const ref = useRef<T>(current); // will be updated on the next render useEffect(() => { ref.current = current; }); // return the existing current (pre render) return ref; }