<div id="app"></div>
console.clear();
const App = () => {
let [myName, setMyName] = React.useState('Ray');
return (
<div>
{ myName }
<button type="button" onClick={ () => myName = 'QQ' }>改名</button>
</div>
)
}
const app = document.querySelector('#app');
const root = ReactDOM.createRoot(app);
root.render(<App />);
View Compiled