nswalters / AppTrakz-Client

React Client for AppTrakz application for documenting the job application process.
0 stars 0 forks source link

FIX - Register and Login components - props.history.push undefined #44

Closed nswalters closed 3 years ago

nswalters commented 3 years ago

Register and Login components are using props.history.push but don't have access to props.

nswalters commented 3 years ago

In Apptrakz.js, define the routes for register and login as follows to resolve:

    <Route path="/register" render={(props) => <Register {...props} />} />

    <Route path="/login" render={(props) => <Login {...props} />} />

This will pass the props to those components. It also ensures that the useState hooks in each respective component continue to work as the components are still being rendered as functional components (resolving the Invalid Hook Call - Hooks can only be called inside the body of a function component error).