Skip to content

Programmatically change display month outside context #1846

Answered by gpbl
tcolinpa asked this question in Support
Discussion options

You must be logged in to vote

@tcolinpa if I understand correctly, you want the month to be controlled by your component. In this case, you should pass the month and onMonthChange props, to keep the month in your component's state.

https://react-day-picker.js.org/basics/navigation#controlling-the-current-month

https://codesandbox.io/s/h6pwj5?file=%2FApp.tsx

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gpbl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants