score:1
Accepted answer
you need to wrap all the route
in the routes
component. you also need to remove the div as route needs direct nesting
import { browserrouter as router, routes, route } from 'react-router-dom';
<router>
<routes>
<route path="/" element ={<homepage />} />
<route path="/whowehelp" element ={<whowehelp />} />
</routes>
</router>
updated component
to element
as pointed out in the comments. component
has been replaced by element
in react router v6. see the changes here
Source: stackoverflow.com
Related Query
- Why Am I getting this Router Error , Check Description for error (React)
- Why I am getting this error message when I run react js project first time in my system?
- Getting this error while using React router TypeError: type.toUpperCase is not a function
- Why am I getting a parsing error in this React component code?
- Why am i getting this error in my React application?
- I am getting error while installing material ui in cmd for react .I am using this command npm i @material-ui/icons and getting following errors ::
- Trying to install webpack 5 with react 17 for module federation, getting this error on npm install
- Why am i getting unexpected token for '<>' error in the following piece of react code
- React Hook useEffect has a missing dependency. Why am I getting this error when nothing is broken?
- Why npm start is getting error for react project?
- Getting the error of cloning for react typescript and react router dom at props.history.push
- Getting this React.Children.only expected to receive a single React element child error for using <Link> in Next.js
- why i am getting this error on using Link tag from next/link? Error: React.Children.only expected to receive a single React element child
- Why I am getting this error while working with react based on my code?
- I'm getting error like this while creating react app
- Why am I getting "potentially invalid reference access to a class field via this in a nested function" error
- Why I am getting this error - Error: EPERM: operation not permitted, mkdir 'C:\Users\Aniket' command not found: create-react-app
- React Native start failed with error code -4094 how to solve this ONCE for ALL?
- react with Rails 5, getting CSRF error for post with axios
- Why am I getting this error - 'You are calling withTheme(Component) with an undefined component.' -React JS
- Why am I getting this error (Tailwind + Next.js)? HookwebpackError, CssSyntaxError
- Getting error when try to use React Router v6: Attempted import error: 'Action' is not exported from 'history'
- Getting error - A column id is required if using a non-string accessor for column above - React
- getting error : Could not find a declaration file for module 'react-bootstrap-modal'. in react js
- Why am I getting error TS2339 on querySelectorAll for checkbox property 'checked' does not exist
- Why React npm start return error for webpack-dev-server 3.11.1?
- Why do I keep getting 404 error for Socket.io polling requests?
- Why is there a semi-colon in the object structure for expected props in this typescript react component?
- Why is this Jest/Enzyme setState test failing for my React app?
- React Router 4, how to check for a possible redirect on all routes?
More Query from same tag
- Use Weather API and sort it by date
- Confusion with lifecycle methods - why is my API call not returning data?
- I want to store an id to the localStorage each time when a user drag and drops
- tsc errors for react-bootstrap in spfx project
- How to connect a custom checkbox / input to LocalStorage in React using a Higher Order Component?
- Can I convert a reference to a React Component into JSON?
- How do I get a value from a child in grand parent?
- How to show the current value in searchLength in react js?
- React: prevent functions from being called multiple times - prevent re-rendering
- How to persist the value of state variables after window reloads in nextJS?
- React Chat Engine Loading
- react className conditional setting according to all of state
- draft-js Cannot read property 'getIn' of undefined ( getUpdatedSelectionState )
- Ref issue using react-hook-form
- Running into cors issue trying to use Google API
- next/link losing state when navigating to another page
- Creating a defaultProps with createTheme in MUI v5 not working
- Material UI Select override Position in theme
- Execute react-apollo-hooks useQuery Only the First Time a Component Renders Idiomatically and Elegantly
- How to get ":name" from "path"?
- Rendering dynamic component after on click event in react native
- No 'Access-Control-Allow-Origin' in Spring Boot + Spring Security + CORS
- React.useEffect has missing dependecies
- React-native: "could not connect to development server"- android app
- react-data-grid cell edit with copy paste
- Cannot read property 'string' of undefined | React.PropTypes
- Javascript Spread Operator Alternative
- How to invoke a function of react component in redux action creator
- Chartjs 3.x - How to duplicate X axis on both sides of horizontal bar chart with only 1 dataset?
- How to resolve Cross-Origin Read Blocking (CORB) blocked problem and fetch api in react