Answers for "react-beforeunload react navive"

0

react-beforeunload react navive

import { Beforeunload } from 'react-beforeunload';

class Example extends React.Component {
  state = { value: '' };

  render() {
    return (
      <>
        {value !== '' && (
          <Beforeunload onBeforeunload={(event) => event.preventDefault()} />
        )}
        <input
          onChange={(event) => this.setState({ value: event.target.value })}
          value={this.state.value}
        />
      </>
    );
  }
}
Posted by: Guest on September-11-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language