Skip to content

Question on Private route redirect #24

Open
@SteveByerly

Description

@SteveByerly

Thanks for all the RR4 goodness.

I'm trying to understand this function a bit more:

function PrivateRoute ({component: Component, authed, ...rest}) {

Why have the render of the Route return the Redirect instead of returning the Redirect directly?

function PrivateRoute ({component: Component, authed, ...rest}) {
  return (
    authed === true
      : <Route {...rest} render={props => <Component {...props} />
      ? <Redirect to={{pathname: '/login', state: {from: props.location}}} />
  )
}

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