react refresh page – How to reload page in react js?

react refresh page – React refresh or reload page Example: how to refresh the page using react window.location.reload(false);

react refresh page – How to Refresh a Page or Component in React?

react refresh page To refresh a page, we need to use the window.location.reload() method in React. In this article, I’m going to share how to reload a component and page in React.js

Method 1: Refresh a Page Using JavaScript



import React from 'react'

class Reload extends React.Component{

    function storeProductData() {

) } } export default Reload;

don’t Miss : Jquery Reload Page Automatically Example

Method 2: Update State


import React, { useState } from 'react';

function ShoppingCart() {
  const [cart, setCart] = useState([]);

  function storeProductData(e) {
    const item =;
    setCart(cart => [...cart, item]);

  return (
    { =>
  • {item}
  • )}
); } export default ShoppingCart;

I hope you get an idea about react refresh page.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment