Question: The problem is that when entering a route that does not exist the does not work, this only happens when I separate the / login and / register routes in another component, is there any way to solve it? Thanks for reading

AppRouter.js

```
import React from 'react'
import {
    BrowserRouter as Router,
    Route,
    Switch,
    Link,
    Redirect
} from 'react-router-dom'

import JournalScreen from '../screens/JournalScreen'
import AuthRoutes from './AuthRoutes'

export default function AppRouter() {
    return (
        <Router>

            <nav>
                <ul>
                    <li>
                        <Link to="/">Home</Link>
                    </li>
                    <li>
                        <Link to="/noexists">no exists</Link>
                    </li>
                    <li>
                        <Link to="/register">register</Link>
                    </li>
                    <li>
                        <Link to="/login">login</Link>
                    </li>
                </ul>
            </nav>

            <Switch>

                <Route exact path="/" component={JournalScreen} />

                <AuthRoutes />

                <Redirect to="/" />

            </Switch>

        </Router>
    )
}

```

AuthRoutes.js

```
import React from 'react'
import { Route } from 'react-router-dom'
import LoginScreen from '../screens/LoginScreen'
import RegisterScreen from '../screens/RegisterScreen'

export default function AuthRouter() {
    return (

        <div className="app__auth">

            <Route path="/login" component={LoginScreen} />

            <Route path="/register" component={RegisterScreen} />

        </div>

    )
}

```

Answer: 
TLDR;

The user will have the permissions of both groups, with any deny permission taking precedence over any allow permission.

Longer answer.
Users in multiple groups will get all the permissions of the combined permissions for the two groups. Permissions in AWS start with no permissions and each permission added grants whatever that permission adds. The exception to this is that a DENY permission always takes precedence. There is no order of permissions, but there are some other considerations.

Some resources (e.g. S3) have resource level policies. As long as an IAM policy doesn’t explicitly deny access to a resource a user may have access to that resource without anything in the IAM policies to grant access.

There are also SCP and permission boundaries can can limit access. For example, you may have granted a user full admin access, but if the permission boundary limits the user to read only the other permissions will be ignored.

There is a lot of really good information about how IAM works on the AWS site. [Understanding how IAM works](https://docs.aws.amazon.com/IAM/latest/UserGuide/intro-structure.html) is a good place to start.
It will be Group1 LOGICAL\_AND Group2, intersection of all the policies.

E.g. Group1 allows the user to launch an instance in any region, whereas Group2 allows the user to launch an instance only in eu-west-2.

Now there are two scenarios, :

[Scenario-1] if Group2 does not have a deny policy, then the user will be able to launch instance in any region.

[Scenario-2] if Group2 have a deny policy to not launch instance in any other region , then the user will not be able to launch instance in any region.

More information on : <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html>