reduxjs/redux

Missing defintion of selectCurrentUsername

mattbal opened this issue · 0 comments

What docs page needs to be fixed?

https://redux.js.org/tutorials/essentials/part-4-using-data#adding-the-login-page

What is the problem?

The documentation is missing a code block showing the selector selectCurrentUsername being defined. Right now, if you read through the section Adding the Login Page, the code block for App.tsx imports selectCurrentUsername from './features/auth/authSlice'. But if you look at the most recent code block defining authSlice, there is no definition for that selector included.

What should be changed to fix the problem?

There's two options:

  1. Create a new code block beneath the App.tsx code block, showing selectCurrentUsername being defined:
// features/auth/authSlice.ts
export const selectCurrentUsername = (state: RootState) => state.auth.username

Or,

  1. Update the original authSlice codeblock to include this:
// features/auth/authSlice.ts
export const selectCurrentUsername = (state: RootState) => state.auth.username