DEV Community

Discussion on: How can I redirect after successful post

Collapse
 
ajaypatel profile image
FoodBite

I'm assuming you're not using router dom, on parent component or the component you want to redirect use state like {renderPost:false} initially,then use method to toggle the state which renders post component , in post component pass a function as prop which makes {renderPost :false} in parent component, so whenever you want to redirect you can use method from props like this.props.Redirect()