0

By default the first route i want it to send me to HOME but when we have something like "/user1234" to userProfileComponent. Now what it happens is that it loads both the Counter and the userProfileComponent.

Is there a way to control that even manually chekcing withe a RegEx or something maybe a rewritte. Like for example if I send /user/123 it will be showned as /user123. Thanks in advance. I think i use react-routerv4

<Layout>  
        <Route exact path='/' component={Home} />
        <Route path='/:userid' component={userProfileComponent} />
        <Route path='/counter' component={Counter} />
 </Layout>;

import * as React from 'react';
import { RouteComponentProps } from 'react-router';
import { RotatingBanners } from '../controls/RotatingBanners';
import { BestOnline } from '../controls/BestOnline';
import { VideoBanner } from '../controls/VideoBanner';
import { PopularCategories } from '../controls/PopularCategories';
import { ExclusiveDeals } from '../controls/ExclusiveDeals';
import { SpotlightStoresFW } from '../controls/SpotlightStoresFW';
import { EmailSignUpFW } from '../controls/EmailSignupFW';
import { BlogFeatures } from '../controls/BlogFeatures';

export class Home extends React.Component<RouteComponentProps<{}>, {}> {
    public render() {
        return (
            <div>
                <RotatingBanners />
                <BestOnline />
                <VideoBanner />
                <PopularCategories />
                <SpotlightStoresFW />
                <ExclusiveDeals />
                <EmailSignUpFW />
                <BlogFeatures />
            </div>
        );
    }
}
vkampouris
  • 499
  • 5
  • 19

0 Answers0