How to reload page in react js?

React.js

Nicesnippets

15952

25-05-2020


Hello Guys,

If you have question how to reload current page then you can show this demo. this first way to refresh component or page use javascript location reload method. in this demo i will show you reload current page onclick button. refresh react component using reload method.

If you have question How to refresh page on button click in react js then follow this tutorial. also refresh page after submit form. In react refresh page without reload using this demo.

/src/Reload.js

import React from 'react'

class Reload extends React.Component{

function refreshPage() {

window.location.reload(false);

}

render(){

return(

<div>

<button onClick={refreshPage}>Click to reload!</button>

</div>

)

}

}

export default Reload;

I hope it can help you...