user11284257
user11284257

Reputation:

How to detect that page has been reloaded Reactjs?

There is stepper of pages with steps 1 2 3. If a page reloads on the second or third step, it has to redirect to the first step.

How can I detect that page has been reloaded?

Upvotes: 0

Views: 592

Answers (1)

You can catch page load when componentDidMount of your root component is fired :

class App extends React.Component {
  constructor(props) {
    super(props);
  }

  componentDidMount() {
    // do something
  }

}

Upvotes: 1

Related Questions