Skip to content
Advertisement

how to use setTimeout on a react component

This question might be simple to most web developers but I am pretty new and cannot figure out the way to put a settimeout function on what I would like to show on a page. below is the example of the code I would like to add a timeout for.

JavaScript

and here is my app.jsx which then will be exported to be used in index.js . What I want is to have lets say 5s delay before my Navbar function shows.

JavaScript

Advertisement

Answer

You can add setTimeout in your App Component. It should look like this:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement