I'm trying to migrate one class component to function with hooks but i have a problem when try to change the url with my history.push.
With my class component this is the way to change the url:
constructor(props) {
super(props)
this.state = {
// GeneralValidate: false,
paisValue: '',
paisError: true,
loading: false,
tipo: '',
};
}
.//more code here
this.props.history.push({
pathname: '/Pais',
state: { detail: 'hola' }
})
And works fine but in my function component the props its empty and i dont know how i cant use the history.push.
const PaisForm = (props) => {
props.history.push("/Pais")
}
What i'm doing wrong? Thanks and sorry for the issues!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…