<div id="root">
</div>
const useLog = (value) => React.useEffect(() => console.log(value), [value]);
const App = () => {
const [ text, setText ] = React.useState('');
useLog(text);
return (
<div>
input: <input type="text" className="border" onChange={ (e) => setText(e.target.value) } />
<h1>你現在輸入的文字是:{ text }</h1>
</div>
)
}
const root = ReactDOM.createRoot(document.querySelector('#root'));
root.render(<App />);
View Compiled
This Pen doesn't use any external CSS resources.