Skip to content

Error: useDayPicker must be used within a DayPickerProvider #4652

Answered by aleighton
dkumza asked this question in Q&A
Discussion options

You must be logged in to vote

I had this same issue a couple of days ago. In my case, I autocompleted an import of <Button /> in my code editor which referenced "react-day-picker" instead of "@/components/ui/button" when I was building a component. It gave me the same error you're having. Simple fix.

import { Button } from "@/components/ui/button"

not

import { Button } from "react-day-picker"

I hope that helps.

Edit. I think the issue is an <Button /> import somewhere else in your code, not this specific component.

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@ahammadabdullah
Comment options

@Luwat
Comment options

@mk48
Comment options

@sa-ma
Comment options

@alexmerzlikin-dev
Comment options

Answer selected by dkumza
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
10 participants