Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

React with Typescript window move to homePage but it restart the data

$
0
0

I am trying for this component move to HomePage but after it's move to the home page it restart the data within..

any suggestion replace window.location.href = "/HomePage"?

import React, {useEffect} from "react";const Thankyou = () => {    useEffect(() =>{        setTimeout(()=>{            window.location.href = "/HomePage"        }, 10000)    }, [])    return (<div className={"movie-container"}><h2>                Thank you for ordering...<br/></h2><h2>Page will redirect in 10 seconds...</h2></div>    )}export default Thankyou;

These are the Routes for the App.tsx

const App: FC = () => {    return (<><Header/><Routes><Route path="/" element={<Navigate replace to='/HomePage'/>}/><Route path="/HomePage" element={<HomePage/>}/><Route path="/FavoritePage" element={<FavoritePage/>}/><Route path="/MoviePage/movie/:id" element={<MoviePage/>}/><Route path="/Thankyou" element={<Thankyou/>}/></Routes></>    )};

This is the index.tsx

ReactDOM.render(<React.StrictMode><BrowserRouter><GalleryProvider><App/></GalleryProvider></BrowserRouter></React.StrictMode>,    document.getElementById('root'));

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>