Using onOpenAutoFocus for state setters in a Dialog #2467
Unanswered
RheingoldRiver
asked this question in
Help
Replies: 1 comment
-
Sorry i do not understand the issue/question. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm using the Dialog component to make a settings modal. I don't want the settings to be "legacy," so they have their internal state that mirrors several global app state variables. I want to reinitialize these every time the settings menu is reopened. The only way I can see to do this is to use
onOpenAutoFocus
and put a setter there, and then not call event.preventDefault().Here is my onOpenAutoFocus function:
But, this doesn't seem like how the API is intended to be used, so I'm not sure if what I'm doing is right. Is there a better way to accomplish what I want?
Beta Was this translation helpful? Give feedback.
All reactions