/
githubmirror
/
jest
Обзор
Документация
Войти
/
githubmirror
/
jest
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
examples/snapshot/Link.js
32 строки
614 B
Đỗ Trọng Hải
feat(examples): replace `react-test-renderer` reference with `@testing-library/react` for snapshot testing (#15806)
28 сен 2025, 10:22
Не верифицирован
28 сен 2025, 10:22
d7aacd9
Код
Авторство
О чём код?
// Copyright (c) Meta Platforms, Inc. and affiliates.. All Rights Reserved. import {useState} from 'react'; const STATUS = { HOVERED: 'hovered', NORMAL: 'normal', }; export default function Link({page, children}) { const [status, setStatus] = useState(STATUS.NORMAL); const onMouseEnter = () => { setStatus(STATUS.HOVERED); }; const onMouseLeave = () => { setStatus(STATUS.NORMAL); }; return ( <a aria-label={status} className={status} href={page || '#'} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave} > {children} </a> ); }