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

Initial value is not set properly #12

Open
dzaiats opened this issue Apr 16, 2022 · 4 comments
Open

Initial value is not set properly #12

dzaiats opened this issue Apr 16, 2022 · 4 comments

Comments

@dzaiats
Copy link

dzaiats commented Apr 16, 2022

Reading the values from the useState() - the initial value has never been set properly and the selected item is always -1.
Does anything have to be configured?

@jkdrangel
Copy link
Owner

@dzaiats You need to put your initial state in the useState function, or pass a initial value directly.
Can you put some example of your code here?

@dzaiats
Copy link
Author

dzaiats commented Apr 16, 2022

Hi @jkdrangel , I mean, that even when I change initial={1} directly in the code, for example, it is not reflected on UI.
Perhaps, the reason that I use the component as a popup custom modal view. And I see the value through the useEffect
The rest of UI components reflect the values properly on change, but not SwitchSelector, unfortunately :(

@NinoKrb
Copy link

NinoKrb commented Sep 8, 2022

Hello,
If the error has been lost from sight, I would like to point out that it still exists. It would be good if it could be fixed.
Best thanks

@artemis-prime
Copy link

@jkdrangel , could you clarify your suggestion about using useState? Perhaps provide an example?

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

4 participants