1

I would like to add a dynamic default path param in my routes.

For exemple, i would like to redirect the user to '/timesheets/2016-07' when he goes to '/timesheets', 2016-07 being the current month.

How could I do ?

1 Answer 1

1

You can do something like:

indexRoute: { onEnter: (nextState, replace) => replace('/timesheets/' + formattedDate()) },

You can reference the documentation on this here: https://github.com/reactjs/react-router/blob/master/docs/guides/IndexRoutes.md

Sign up to request clarification or add additional context in comments.

1 Comment

That's exactly what I was looking for. Thanks a lot.

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.