Skip to content

Router Not Working #67

@Spectrevuln-sketch

Description

@Spectrevuln-sketch

i have some project and i wanna build wp theme with create-react wptheme but route is not working
i already follow some tutorial in http://michaelsoriano.com/wordpress-theme-react-part-2-routes-context/ but router still not working
this my code below

import React from 'react'
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
import Archive from './templates/Archive';
import Single from './templates/Single';


const Routes = () => {
    return (

        <Router>
            <Switch>
                <Route exact path="/" component={Archive} />
                <Route path="/page" component={Single} />
            </Switch>
        </Router>
    )
}

export default Routes

in the single page

import React from 'react'

const Single = (props) => {
    return (
        <div className="Post">
            PAge Single
        </div>
    )
}

export default Single

i use react-router-dom version 5.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions