<div id="root"></div>
function App() {
const [value, setValue] = React.useState("");
return (
<>
input:
<input
id="name"
value={value}
onInput={(e) => setValue(e.currentTarget.value)}
/>
<div>state: {value}</div>
<a href='javascript:(function(){var a=document.getElementById("name");a.value="\u5c71\u7530";a._valueTracker.setValue("");a.dispatchEvent(new Event("input",{bubbles:!0}))})();'>
Bookmarklet
</a>
</>
);
}
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<App />);
View Compiled
This Pen doesn't use any external CSS resources.