Answer the question
In order to leave comments, you need to log in
How to make a route to a simple one-pager on one host on react?
There is react and a one-pager on the same hosting, it is necessary that when you click on a post there is a transition to a one-pager made on regular .html, is this possible? (I thought I could import it as a variable and put it instead of RegForm, but react does not allow index.html to be imported).
Here's what I came up with, done through react-router-dom:
<Link to={'/landing'} className={s.project}>
<div>Landing link</div>
</Link>
<Switch>
<Route path='/landing'>
<RegForm />
</Route>
</Switch>
Answer the question
In order to leave comments, you need to log in
<Switch>
<Route path='/landing' component={() => {
window.location.href = 'https://example.com/1234';
return null;
}}>
</Route>
</Switch>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question