score:0
you can manipulate the state of the notification in the state of the component that have all pages routes, for example:
const [needsnotification, setneedsnotification] = usestate('true');
<switch>
<route
path={'/home'}
render={<home props={...props, needsnotification}} />
/>
<route
path={'/another-page'}
render={<anotherpage props={...props, setneedsnotification} />}
/>
<switch/>
in the anotherpage component you use the function props.setneedsnotification(false)
when it mounts and in the home page you create a condition that the warning is only shown if needsnotification === true
.
Source: stackoverflow.com
Related Query
- hide component when route another page in react js
- CSS not changing when using React Router to route to another component
- React router Redirect does not work when route comes from another component
- React Router not rendering component passed to route when wrapped in another component
- How to hide a child component when changing React route
- Route to another component and page when click on an image reactjs
- How to open pop up modal when form submit sucessfully and hide pop after 2 mintues and redirect to another page in react js?
- Hide a component and display another component within a component page - react js
- React countup animation starts immediately after the page loading , should start when scrolled to the component (without jquery)
- How to pass the match when using render in Route component from react router (v4)
- Dynamic import in react not working when trying to import a component in another directory
- React router is not reloading page when url matches the same route
- React - setState not re-rendering page when Axios call in separate component
- React Router - 404 page always showing due to custom route component
- how to update a route in React Router without re-mounting the component in a single page app?
- Custom React Component Library not loading CSS when installed as dependency in another react project
- React Relay Modern redirecting to another page when receiving 401 error on network environment
- Prevent page reload when rendering ui fabric react nav component
- Scroll down the page to another React component on a button click
- How to render React Route component in an entirely new, blank page
- React component bundled as an UMD can't load a dependency when imported via script tag in another react app
- Prevent React component re render when route change
- react router v4 redirecting to another page outside of component
- Component Missing when Nested inside of Route in React Router v6
- In React How to pass Id to another page class component
- React Router will not render Route component unless page is refreshed
- React re-render component when another component is changed
- Javascript / React - Remove specific item from Local Storage on click when rendered in another component
- React return Outlet component when I use render in route
- Link Button to route to the another component is not working in React js
More Query from same tag
- How to set credentials property in ReactJs fetch by fetch-interceptor
- React App Gives Error At Serving Bundled Files
- Could someone help me understand how this component class works
- its continously showing Error: Invariant failed: You should not use <Link> outside a <Router> tried many things but still not working
- Not able to access store on non react component
- React child to parent communication
- redux-form Migration to v6 throwing error in getValues.js
- Why is contextBridge not being imported in my Electron app?
- Call a function from a class in another file
- React Router | call function on private router
- How to share asset requests between components using react hooks?
- Referencing DOM Elements with React Hooks
- Search bar, <input/>
- Is there a way to avoid purging a specific library with Tailwind?
- Add/Remove active class from dynamically built list of buttons for sidebar
- How to use useState in React 15 with react-bootstrap
- How to make React Leaflet Marker popup in right side always?
- Getting props via state object
- How to type functions in useRef hook with TypeScript
- Can we use class components as children for functional components in React?
- How does React Context work by using a function inside of a component
- How to destructure an Object from Array with useState in React
- Is there a function in ReactJS to wait for a Redux Action to be complete before loading anything in a class?
- Cant turn on switch inside Material-Table
- Re-render child when prop changes in App.js
- Making an axios get request and using React useState but when logging the data it still shows null
- Why is my JSX rendering a <tr> when it shouldn't?
- Data passed as props is not shown in django and reactjs
- Calling a method after fetch has been executed
- react material-table onrowadd fails