You’re doing a few things wrong.
- First, browserHistory isn’t a thing in V4, so you can remove that.
- Second, you’re importing everything from
react-router
, it should bereact-router-dom
. - Third,
react-router-dom
doesn’t export aRouter
, instead, it exports aBrowserRouter
so you need toimport { BrowserRouter as Router } from 'react-router-dom
.
Looks like you just took your V3 app and expected it to work with v4, which isn’t a great idea.
Related Posts:
- “SyntaxError: Unexpected token < in JSON at position 0"
- How to use Redirect in the new react-router-dom of Reactjs
- You should not use Route or withRouter() outside a Router when using react-router 4 and styled-component in react
- React-Router only one child
- Uncaught TypeError: Cannot read property ‘props’ of null
- How to refresh a Page using react-route Link
- How to implement authenticated routes in React Router 4?
- React Js: Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
- onEnter not called in React-Router
- Cannot read property ‘getHostNode’ of null
- React-Router : What is the purpose of IndexRoute?
- React router not showing browser history
- React, Uncaught ReferenceError: ReactDOM is not defined
- Getting “Cannot call a class as a function” in my React Project
- “SyntaxError: Unexpected token < in JSON at position 0"
- Invariant Violation: Objects are not valid as a React child
- Invariant Violation: Objects are not valid as a React child
- What is Virtual DOM?
- SyntaxError: Unexpected token o in JSON at position 1
- SyntaxError: Unexpected token o in JSON at position 1
- What is JSONP, and why was it created?
- TypeError: Converting circular structure to JSON in nodejs
- React.js: Set innerHTML vs dangerouslySetInnerHTML
- React – uncaught TypeError: Cannot read property ‘setState’ of undefined
- Understanding unique keys for array children in React.js
- How to do a redirect to another route with react-router?
- Jest spy on functionality
- Use a JSON array with objects with javascript
- Difference between npx and npm?
- Array of JSON Objects
- Chrome sendrequest error: TypeError: Converting circular structure to JSON
- Fetch: POST JSON data
- Uncaught SyntaxError: Unexpected token u in JSON at position 0
- Reactjs – Form input validation
- TypeScript React.FC
confusion - Unexpected token u in JSON at position 0 (but only sometimes)
- Error Running React Native App From Terminal (iOS)
- How to read an external local JSON file in JavaScript?
- SyntaxError: Unexpected token o in JSON at position 1
- SyntaxError: Unexpected token o in JSON at position 1
- Axios Delete request with body and headers?
- Loop inside React JSX
- Can’t resolve module (not found) in React.js
- How to read an external local JSON file in JavaScript?
- How to implement navbar using react
- Loop inside React JSX
- What is the convention in JSON for empty vs. null?
- Understanding React-Redux and mapStateToProps()
- how to render a react component using ReactDOM Render
- React this.setState is not a function
- Console logging for react?
- Parse Error: Adjacent JSX elements must be wrapped in an enclosing tag
- What is the “right” JSON date format?
- ‘react-scripts’ is not recognized as an internal or external command
- After $npm install, Getting Error: Cannot find module ‘../lib/utils/unsupported.js’
- Nested JSON objects – do I have to use arrays for everything?
- Uncaught TypeError: Cannot read property ‘length’ of undefined
- React Native: this.setState is not a function
- React: trigger onChange if input value is changing by state?
- In reactJS, how to copy text to clipboard?
- SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag
- What is the “right” JSON date format?
- What does the className attribute mean in JSX?
- What is prevState in ReactJS? [duplicate]
- React with ES7: Uncaught TypeError: Cannot read property ‘state’ of undefined
- React Hook Warnings for async function in useEffect: useEffect function must return a cleanup function or nothing
- Setting a backgroundImage With React Inline Styles
- React – TypeError: Cannot read property ‘props’ of undefined
- How to compare arrays in JavaScript?
- Failed to load resource: net::ERR_FILE_NOT_FOUND loading json.js
- What is the difference between state and props in React?
- How to pass props to {this.props.children}
- React eslint error missing in props validation
- jQuery AJAX cross domain
- OnChange event using React JS for drop down
- ESLint Parsing error: Unexpected token
- React Context vs React Redux, when should I use each one?
- SyntaxError: Unexpected token o in JSON at position 1
- Setting onSubmit in React.js
- How to import image (.svg, .png ) in a React Component
- ReactJS: setTimeout() not working?
- React Uncaught Error: Target container is not a DOM element [duplicate]
- React Error: Target Container is not a DOM Element
- Loading local JSON file
- How to convert JSON object to JavaScript array?
- node.js TypeError: path must be absolute or specify root to res.sendFile [failed to parse JSON]
- Uncaught TypeError: data.push is not a function
- Console is throwing Unterminated JSX contents error
- How to scroll to an element?
- How to handle the `onKeyPress` event in ReactJS?
- setInterval in a React app
- How to convert selected HTML to Json?
- Cannot read property ‘bind’ of undefined. React.js
- How do you Hover in ReactJS? – onMouseLeave not registered during fast hover over
- Failed to compile. Module not found: Can’t resolve ‘react-router-dom’
- ReactJS: setTimeout() not working?
- What does “export default” do in JSX?
- How to add multiple classes to a ReactJS Component?
- How to get JSON from URL in JavaScript?
- How do you put an image file in a json object?