createSlicebeginnerfunction selectName(state) { return state.user.name }
selectName(store.getState()) // β 'Alice'Selectors are plain functions that receive state and return a slice of it β keeping component logic decoupled from store shape.
Selectors are plain functions that extract data from Redux state. They keep your component code free from knowledge of the state shape.
Challenge: Create a store with a user slice, then write selectName and selectAge selectors.
selectName(store.getState()) // β 'Alice'
selectAge(store.getState()) // β 30