close

[Solved] How to refresh a Page using react-route Link

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error How to refresh a Page using react-route Link in javascript. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How to refresh a Page using react-route Link Error Occurs?

Today I get the following error How to refresh a Page using react-route Link in javascript.

How To Solve refresh a Page using react-route Link Error ?

  1. How To Solve refresh a Page using react-route Link Error ?

    To Solve refresh a Page using react-route Link Error i was with the same issue and i resolved by using a href instead of Link
    <a href='/'>

  2. How to refresh a Page using react-route Link

    To Solve refresh a Page using react-route Link Error i was with the same issue and i resolved by using a href instead of Link
    <a href='/'>

Solution 1

In the Route component, specify a random key.

<Route path={YOURPATH} render={(props) => <YourComp {...props} keyProp={someValue} key={randomGen()}/>} />

when react see a different key, they will trigger rerender.

Solution 2

i was with the same issue and i resolved by using a href instead of Link

<a href='/'>

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment