Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to navigate to another page with settimeout reactjs

import { useState } from "react";
import { Redirect } from "react-router-dom";

function SplashScreen() {
  const [redirectNow, setRedirectNow] = useState(false);
  setTimeout(() => setRedirectNow(true), 2000);
  return redirectNow ? (
    <Redirect to="/game" />
  ) : (
    <div className="SplashScreen">
      <h1>Hello World</h1>
    </div>
  );
}

export default SplashScreen;
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to add a message sound in angular 
Javascript :: change base js 
Javascript :: document.getelementsbyclassname equivalent in jquery 
Javascript :: nextjs link image 
Javascript :: JQuery Autocomplete no result found 
Javascript :: how to send csrf middleware token in django ajax 
Javascript :: filter in javascipt 
Javascript :: mongoose autoincrement 
Javascript :: jquery parsexml get attribute 
Javascript :: selialize jquery 
Javascript :: Get the language of a user 
Javascript :: angular 8 remove cookies 
Javascript :: custom indicator js tradingview 
Javascript :: array remove duplicates javascript 
Javascript :: shorthand if in javascript with return 
Javascript :: change view port of svg with javascript 
Javascript :: How to validate an unicode email address in JavaScript 
Javascript :: image downloader extension in nodejs 
Javascript :: reverse array in javascript 
Javascript :: how to create instance of class in javascript 
Javascript :: cai nodejs ubuntu 
Javascript :: get the key of largest json array value 
Javascript :: reactjs npm take photo 
Javascript :: The data option must be a function. Plain object usage is no longer supported. vue 
Javascript :: why .env file in node.js is not working to connect mongodb 
Javascript :: angular size of array 
Javascript :: javascript find prototype 
Javascript :: sequelize find result as raw json 
Javascript :: getters and setters javascript 
Javascript :: Sum of Polygon Angles in javascript 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =