/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-devtools-shell/src/multi/left.js
26 строк
717 B
Ruslan Lesiutin
chore: gate legacy apis for react-devtools-shell (#28273)
09 фев 2024, 14:27
Не верифицирован
09 фев 2024, 14:27
03d6f7c
Код
Авторство
О чём код?
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import * as React from 'react'; import {useState} from 'react'; import {createRoot} from 'react-dom/client'; function createContainer() { const container = document.createElement('div'); ((document.body: any): HTMLBodyElement).appendChild(container); return container; } function StatefulCounter() { const [count, setCount] = useState(0); const handleClick = () => setCount(count + 1); return <button onClick={handleClick}>Count {count}</button>; } createRoot(createContainer()).render(<StatefulCounter />);