score:0
you can use 'react-router-dom'
- import navigate
import { navigate } from "react-router-dom";
- then just run this method
...
myfunction() {
this.props.history.push("/home");
}
...
}
Source: stackoverflow.com
Related Query
- Redirecting in react js class based components
- When to use ES6 class based React components vs. functional ES6 React components?
- React class components - conditional styling based on props
- Conversion of functional components in react into class based component
- Unable to mount the component in react class based components
- How to checked checkbox using state in react in class based components
- How to make pure components in react js using functional approach i.e. non class based
- How do we call recursive function on react js in class based components
- Passing in class names to react components
- React Function Components with hooks vs Class Components
- React - adding class to children components
- Toggle Class based on scroll React JS
- React Iterate and insert components based on count of array
- React hooks: How to write variables in functional components that in class components were initialized in the constructor
- Class based component vs Functional components what is the difference ( Reactjs )
- How to sort list of React components based on different properties?
- How to use redux-toolkit createSlice with React class components
- How to test class components in react
- What is the difference between arrow functions and regular functions inside React functional components (no longer using class components)?
- Changing components based on url with react router
- How to convert React class components into functional components and vice versa - IntelliJ
- React Gatsbyjs add class to gatsby-image based on aspect ratio
- Redirecting user based on state in React
- Update child state based on parent state react functional components
- Can I select all react components of a type, without assigning a class to each one?
- Is there a non-hook alternative for the React Material-UI makeStyles() function that works for class Components
- React hover animation based on class
- How to pass down data through 3 class components in react correctly?
- Which React Material-UI components add a spacing to my page (like a row class in Bootstrap)?
- Can't style my React Components by Class Name in Storybook
More Query from same tag
- Filter array of object based on multiple conditions in React
- push some objects into array after some specific index using javascript
- How to create a resizable component in React
- How to add different styles to span tag based on its content using react or javascript?
- precacheAndRoute TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
- Test failures during styles file imports
- What is <> In React JSX?
- Programatically generating an SVG and assigning it to the background-image of an element
- ReactJS - Highlight the input fields only when it is changed
- Set state based on other objects in state?
- How to solve this error: 'Firebase' is not defined
- You may need an appropriate loader to handle this file type
- Create ref to external class component inside functional component in React
- Material UI auto complete value and onChange
- Pubnub is sending heart beat to multiple uuid?
- Is there any way to add a discriminator property to read data into a discriminated union object with Axios + Typescript?
- Working with component state or props inside Redux mapDispatchToProps
- Throttle touch event with React Hooks
- How do you set an active state on one component at a time, and remove the active state on all others in React?
- When I switch between nested routes (subroutes) using 'Link' , parent component unmounts. Is there any way to avoid this?
- How to get queryString from url?
- How to define the type of a prop, which is a functional component while specifying the FC's various prop types
- How to stop re-rendering all Childs in React render function when I change just one child value?
- Passing props in React jsx as generics
- Blank white screen after React run build
- How to split dynamically by directories with Webpack/SplitChunks plugin?
- Add anchor to react bootstrap table
- State is not updated in StrictMode
- The sx styling for Drawer element does not work
- body data not sent in axios request