Skip to content

Remounting Main Component #224

Open
Open
@rjardines

Description

@rjardines

Hello,

I have a kind of master details page, something like:

/user
/user/m1
/user/m2

The authentication is defined to the main route user so every nested route must be authenticated, but every time the route change the user component is remount/

This is my setup

export const isUserAuthenticated = connectedRouterRedirect({
  // The url to redirect user to if they fail
  redirectPath: "/login",
  // Determine if the user is authenticated or not
  authenticatedSelector: state => state.user != null
  // A nice display name for this check
  wrapperDisplayName: "UserAuthenticated"
});
<Route path="/user" component={isUserAuthenticated (UserComponent)} />
<Route path="/user/m1" component={M1Component} />
<Route path="/user/m2" component={M2Component} />

Thanks in advance

Note: If I remove the authentication HOC like
<Route path="/user" component={UserComponent} />
everything works fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions