📅  最后修改于: 2022-03-11 15:03:33.088000             🧑  作者: Mango
import { Beforeunload } from 'react-beforeunload';
class Example extends React.Component {
state = { value: '' };
render() {
return (
<>
{value !== '' && (
event.preventDefault()} />
)}
this.setState({ value: event.target.value })}
value={this.state.value}
/>
>
);
}
}