declaring react routes in a separate file and importing code example
Example: declaring react routes in a separate file and importing
import { BrowserRouter as Router, Route, Link, Switch, useParams } from "react-router-dom";
export default function App() {
const name = 'John Doe'
return (
);
}
const About = () => {
const { name } = useParams()
return (
// props.match.params.name
{ name !== 'John Doe' ? : null }
About {name}
)
};