how to refresh the page using react
window.location.reload(false);
how to refresh the page using react
window.location.reload(false);
force rerender react
const [, forceUpdate] = useReducer(x => x + 1, 0);
function handleClick() {
forceUpdate();
}
refresh a single component
import React from "react";
class App extends React.Component {
handleRefresh = () => {
// by calling this method react re-renders the component
this.setState({});
};
render() {
return (
<div>
<h1>{Math.random()}</h1>
<button onClick={this.handleRefresh}>Refresh component</button>
</div>
);
}
}
export default App;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us