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
Bug: useReducer triggers reducer one more time in React 18 Responsive Mode #27666
Comments
ISSUE SOLVE @silviuaavram #27666============================ React 17, one dispatch call per event: https://codesandbox.io/s/unruffled-volhard-x92hq6?file=/index.js
- What is Strictmode in react
Ans :
CODE=================================
**after this code check devtool console ** root.render(
);
|
Your Componenet RELATED ISUUE SOLVE @silviuaavram #27666 #bug===================================== Why use useReducer
How Use This Hook
FULL CODE===============================
|
I must have missed the StrictMode, thanks for pointing in out! Will continue the investigation on my end. |
Re-did the repro. Will update the description and reopen the ticked. |
hello @silviuaavram
|
Check the description
…On Thu, 9 Nov 2023 at 14:29, Jyotiprakash-Redapple ***@***.***> wrote:
hello @silviuaavram <https://github.com/silviuaavram>
- The Reducer function triggers only when call the dispatch function
if you not call the dispatch function then not trigger the reducer function.
- could you give code suggestion on how this type of scenario happen ?
—
Reply to this email directly, view it on GitHub
<#27666 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACWAZACCS3EVNZYOYHST6UTYDTSEZAVCNFSM6AAAAAA7CW5NNSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBTHEZTQNJRGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
hello @silviuaavram Solve : useReducer triggers reducer one more time in React 18 Responsive Mode #27666
A function must pass two tests to be considered “pure”:
|
Thanks, @Jyotiprakash-Redapple. It may not be a bug, but it's a different behaviour between 17 and 18 and I need to understand how to address it, as it affects a lot of my users. Updated the code with the |
yes @silviuaavram it is unexpected behavior React.js 18 |
1 similar comment
yes @silviuaavram it is unexpected behavior React.js 18 |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you! |
React version: 18.x.x
Steps To Reproduce
Repro Sandbox: https://codesandbox.io/s/rough-water-w3fh5k?file=/App.js
This extra click seems to happen only when the element also has an onMouseMove handler attached to it, and which in turn triggers a dispatch.
Our problem in
downshift
comes from the fact that we are adding both click and mouse move handlers to an element, both which can trigger state updates. This issue impacts our users that want to migrate to React18 and expose their Selects / Comboboxes for mobiles.The text was updated successfully, but these errors were encountered: