score:0
you can not do this in easy ways. the best thing to do to fix this is to add condition on the data you get from the server that if data is empty, after you can use condional rendering and set if data is null you return some jsx that show this page has no data ;
// if user select /user/23
{data?<div>empty ! </div>}
but if you select route like /usersdadsa and didnt catch any error or didnt redirect to notfound page you have to set react router in this approach //if user select /udasuasdusad
<route path='*' component={notfound} />
and put it in the end of your routes , when user select your route , react router try to match the user route with your routes and if any route doesnt match so they found your last route that tell react router to all path should render notfound component
Source: stackoverflow.com
Related Query
- Multi layout react routing with 404 component and without re-rendering layout on URL change
- Difference between with and without useEffect in react functional component
- Single React Component rendering with Babel Standalone with only index.html and Component
- Why is my React component render called twice, once without data and then later with data, but too late exception?
- React isomorphic component with both client-side and server-side rendering
- React Router difference between component with and without function
- Rendering a redux component with and without children
- react scroll to a component without react router and with most basic code
- Why is React rendering my component over and over with an unchanged state?
- React importing and rendering other component not working without tooling
- React rendering the component twice and 2nd disappears after a flash, [DOM] found 2 elements with non-unique id
- Is there any difference between rendering a functional component with and without hooks?
- Express server with React front end routing without server side rendering
- React: Creating A Component with ES6Class and rendering it without JSX
- Create and download image of a react component without rendering it
- How create React Typescript component with required and optional values but required value without default value?
- Fetching data from firebase with React Class component is rendering twice and even more
- Rendering same component both in try and catch block in React without loosing focus of fields in ReactJS
- Control html dynamically without component re rendering in React with Apollo
- How to mock React component methods with jest and enzyme
- Prevent react component from rendering twice when using redux with componentWillMount
- React - useRef with TypeScript and functional component
- How to test decorated React component with shallow rendering
- Using React Router with CDN and without webpack or browserify
- Spying on React functional component method with jest and enzyme; Cannot spyOn on a primitive value
- Jest/Enzyme Class Component testing with React Suspense and React.lazy child component
- How to test a component with a nested container with React and Redux?
- using mobx with react functional components and without decorators
- Error using component done with react,redux and react-redux and build with webpack in react application
- React component with Edit Mode and View Mode, is this a correct pattern?
More Query from same tag
- In React How can I fetch data and render a single object in a states array without mapping the whole thing?
- TypeError: items.map is not a function , how to solve this error
- How Do I Pass on an Array of Objects using "forEach" Function?
- Pagination drop down not working react-bootstrap-table2
- How to make this dynamic URL request to an API?
- React: How to get the ref height of an element coming from the children with dynamic height?
- Is it possible to use a custom hook inside useEffect in React?
- Save a favorite icon when a user logs out or refreshes the page, react, mern stack
- Trying to change the ReactMapGL cursor from the default hand icon to a pointer or crosshair
- How can I change the color of a child component when clicked?
- Configure Base Url in Axios with React Typescript
- Set env in windows command line/ package.json
- ES6 best way to import React's named imports
- How to concat string and add html tag to it?
- Can I assign default props from other component's default props
- HTML Video tag not updating source on re render
- How to get the current theme in a spfx webpart using the new ts based styling approach
- How to use react-lazyload or react-lazy-load without set height prop?
- React js calculate dates from date inputs
- React setState working then getting undefined
- Target native dom element <input>...</input> with styled-components
- Handling action in Remix.run without POST
- Direct access to a doc in an documen query array returns undefined outside of the onSnapshot() block
- TypeError: Cannot convert undefined or null to object (referring to Object.keys)
- How to use tree shaking for node modules with Webpack 5?
- Measuring performance of Next.js page with performance.now
- Confused about return value in arrow function?
- Cant send AXIOS request from react test
- Could not get BatchBridge, make sure your bundle is packaged correctly
- FullCalendar make editable option view-specific