1

I am trying to restore my scroll position at the top with every change of the page. I don't want that it will scroll to the top, I want to make it at the top with the link click.

App.js

class App extends React.Component {
  render() {
    return (
      <Provider store={store}>
        <BrowserRouter style={{ height: "100%" }}>
          <Switch>
            <Route exact path="/login" component={AuthPage} />
            <Route exact path="/signup" component={Signup} />
            <Route exact path="/reset_user" component={ResetUser} />
          </Switch>
        </BrowserRouter>
      </Provider>
    );
  }
}

export default App;

index.js

ReactDOM.render(
  <App />,

  document.getElementById("root")
);

store.js

const initialState = {};

const middleware = [thunk];

const store = createStore(
    rootReducer,
    initialState,
    compose(
    applyMiddleware(...middleware),
    window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
))

export default store;
Drew Reese
  • 165,259
  • 14
  • 153
  • 181
pkay14
  • 25
  • 7

0 Answers0