Advertisement
Guest User

Untitled

a guest
Jan 24th, 2023
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { createSlice } from '@reduxjs/toolkit';
  2.  
  3. export const profileSlice = createSlice({
  4.     name: 'profile',
  5.     initialState: {
  6.         name: 'Default User'
  7.     },
  8.     reducers: {
  9.         setName: (state, action) => {
  10.             state.name = action.payload;
  11.         }
  12.     }
  13. });
  14.  
  15. export const { setName } = profileSlice.actions;
  16.  
  17. export const selectName = (state) => state.profile.name;
  18.  
  19. export default profileSlice.reducer;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement