Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"onChange is not a function" #118

Open
Redblock6YT opened this issue Aug 15, 2022 · 1 comment
Open

"onChange is not a function" #118

Redblock6YT opened this issue Aug 15, 2022 · 1 comment

Comments

@Redblock6YT
Copy link

I'm using nextjs and when I click the switch this is the error I get:
image
Here's my code:
<label> <span>Switch with default style</span> <Switch onChange={handleChange(1)} checked={isActive(1)} /> </label>

@markusenglund
Copy link
Owner

It looks like you're invoking the handleChange function which means you're passing whatever that function returns to the Switch component. You should be passing the function itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants