score:1

Accepted answer

one thing would be to use :

<route exact path="/" component={withapplayout(voting)} />

the exact will make sure that only that exact path is going to match. but if you have the path="/" after the others, the others should match first though. is this the real code you're using ?

edit: see a complete version below.

import {browserrouter, route, switch} from 'react-router-dom'

reactdom.render(
    <browserrouter>
        <switch>
            <route exact path="/" component={voting} />
            <route path="/results" component={results} />
        </switch>
    </browserrouter>,
    document.getelementbyid('app')
);

then, if that works out, you can move the switch part into an app component. also, if you want to use hash history, you need to use a hashrouter that basically initializes a router with a hash history.


Related Query

More Query from same tag