I created a Preact app using the preact-cli, and need to add react-router-dom
to my project for routing. How can I add react-router to the project without ejecting the app, in order to install the router library?
I've seen options for adding webpack, but that' requires ejecting the app.
I added "preact-compat": "^3.19.0",
to my package.json in the project, but not sure how to either add webpack or import the necessary react-router imports:
import {BrowserRouter as Router, Route, Switch, NavLink} from 'react-router-dom';
Was able to get this working with import of import {BrowserRouter as Router, Route, Switch, NavLink} from 'react-router-dom';
and yarn build
then yarn-serve