DEV Community

Developer Ruhul
Developer Ruhul

Posted on

How to make react router replace component only after the matched route asynchronously loaded..?

So here's the situation - When a Link is clicked the nprogress bar will start and I want react-router to only replace the current component with the matched route once that's done loading asynchronously.. just like in instagram..

enter image description here

But I am only getting this -

enter image description here

I didn't find a solution to this anywhere on the internet.. so I am asking this question here in dev. I am hoping someone here can solve this.

Discussion (5)

Collapse
dukemai profile image
dukemai

I think React Transition Group is something you are looking for

Collapse
sagar profile image
Sagar

Can you share sample codebase.it helps us finding solution๐Ÿ’ช๐Ÿ˜„๐Ÿ‘Œ

Collapse
developerruhul profile image
Developer Ruhul Author

did u find any solution??

Collapse
sagar profile image
Sagar

I'm trying to solve this issue. In ours project we have implemented react-lodable. Your facing flicker issue. Definitely solution is to provide delay in 5000.

Collapse
developerruhul profile image
Developer Ruhul Author