score:0

i had the same issue a while back.

here's how i fixed it -

history.js

import { createbrowserhistory } from 'history';

export default createbrowserhistory();

app.js

class app extends component {
    render() {  
    return(
   <router history={history}>
      <router history={history}>
                <switch>
                    <route
                        path="/sign-up"
                        render={(props) => <signupform {...props} />}
                    />

                    <privateroute
                        exact
                        path={routes.home}
                        component={homepage}
                    />

                </switch>
            </router>
     );
   }
 }

signupform.js

import history from "./routes/history";

class signupform extends react.component {

    handlesignup = (e) => {
  //add your success logic here
                    history.push("/home");
                }
    render() {
        return (
            <form onsubmit={this.handlelogin}>
                <div classname="form-submit">
                    <button
                        variant="outline-success"
                        size="xs"
                        block
                        type="submit"
                    >
                      submit
                    </button>
                </div>
            </form>
        </div>
    </div>
  );
}
 }


Related Query

More Query from same tag