When you click Go to Welcome either from Login screen or SignUP screen, you reach the same destination , that’s Welcome screen. For common Destinations, you can reuse actions by declaring them outside of any destination tags.
Such actions are called Global actions. You’ll now make showing Welcome screen a global action. Open your navigation graph.
Move actionWelcomeFromLogin from inside fragment to direct child of Navigation, rename it to actionWelcome. Now delete actionWelcomeFromSignUp Now go to LoginFragment
Correct the action name to actionWelcome . Go to SignUpFragment. Correct the action name to actionWelcome. Build and run the app.
Click Log In button. Enter details and Login. Click Go to Welcome and you can see Global action works. Verify same for SignUp.
Click Sign Up button. Enter details and Sign Up. Click Go to Welcome and you can see Global action works.