How to use useNavigate( ) React-Router-Dom Hook in Class Component ?
export default class MovieForm extends Form {
state = {
data : {},
error : {},
}
onSubmit(){
// Navigate to Another Component
}
render(){
// rendering the Form UI
}
}
I want to Navigate to Another Component on Submitting the Form.
Official React-Router-Dom Documentation Says I can use 'useNavigate( )' Hook only inside a Functional Component.
I have a class Component and I can't make it functional Component. because It extends the Form Class and I want all the Functionality of Form Class in this MovieForm Component.
So how can I Navigate to Another Component.