React let the route jump automatically after judging that the return value of the interface is correct.

in actions, a method is defined to call the interface, and then the method defined in actions is called in the page. When the actions method successfully requests the interface, how to automatically jump to the specified path,

wrote this.props.history.push ("") in actions, then reported to history undefined, and then tried a lot of writing methods, but failed to achieve results. Please help me and give some ideas. Thank you very much

.
Apr.08,2022
The

method call uses the method name. Bind (this, parameter) , change the this > point to


first introduce import {Link, withRouter} from "react-router-dom";
then wrap const Component = withRouter (createForm () (_ Component));
so that history will not report undefined

Menu