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

useNumber contains content of useArray #35

Open
mxzinke opened this issue Oct 8, 2019 · 9 comments
Open

useNumber contains content of useArray #35

mxzinke opened this issue Oct 8, 2019 · 9 comments
Labels
invalid This doesn't seem right question Further information is requested

Comments

@mxzinke
Copy link

mxzinke commented Oct 8, 2019

If I call the useNumber() hook, it basically uses the code of useArray hook and returns me an array.

At source folder in the sub-directory array is the file of the correct useNumber() hook.

@RIP21
Copy link
Collaborator

RIP21 commented Oct 8, 2019 via email

@RIP21
Copy link
Collaborator

RIP21 commented Oct 8, 2019

@mxzinke okay, I looked. It's all good. It reuses /array/useNumber version internally, to reuse the code. If I'm getting it right. So nothing is wrong I think. Clarify pls? Maybe some code example?

@mxzinke
Copy link
Author

mxzinke commented Oct 8, 2019

Okey I took a closer look and I was wrong. If I use the value of useNumber, then it returns NaN on decrease and on increase an Object-Array. I am not sure what is wrong on the code

@RIP21
Copy link
Collaborator

RIP21 commented Oct 8, 2019

@mxzinke maybe initial state is missing? Dunno, will be nice to find and fix the issue and then cover with tests. Codesandbox.io repro maybe?

@RIP21 RIP21 added invalid This doesn't seem right question Further information is requested labels Apr 19, 2020
@brxck
Copy link

brxck commented Jul 5, 2020

It would seem this is currently happening in the demo? Every example of useNumber is broken in some way.

@kitze
Copy link
Owner

kitze commented Apr 2, 2021

@RIP21 what about this one? not sure if we should close or fix something

@RIP21
Copy link
Collaborator

RIP21 commented Apr 2, 2021

@kitze I'll try to look at all my OSS issues this evening. It's been awhile :)

@bianzheCN
Copy link

Hi guys, this issue exists because in onClick={counter.increase}, the SyntheticEvent object will be passed as param, so for increase it will be transformed into [Object object] and NaN for decrease.

@RIP21
Copy link
Collaborator

RIP21 commented May 21, 2021

Yup, sounds like true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants