0

I am learning react-native, i have 3 screen login screen, Home screen and Profile screen. Here i need to store my user name from login screen using redux, and i need to get that user name in profile screen. How can achieve this. here my sample code. action.js

          const GET_USER="GET_USER";
            export const getUser = user => ({
                type: 'GET_USER',
                payload: user,
              });    
            export default getUser

        reducer.js

            const user = (state = {}, action) => {
                switch (action.type) {
                  case 'GET_USER':
                    return action.payload;
                  default:
                    return state;
                }
              };   

              export default user;        
2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.