question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onChange in handleChange is called on every change to store

See original GitHub issue

Do you want to request a feature or report a bug? bug What is the current behavior? Any change to the redux store cause the onChange function to be executed. This causes our app to slow down a lot.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:

What is the expected behavior? For the onChange to only be called when the localize part of the state is changed

Which versions of react and react-localize-redux are you using? react: 16.8.6 reat-localize-redux: 7.0.3 redux: 4.0.1

Redux suggest something like this function observeStore(store, select, onChange) { let currentState;

function handleChange() { let nextState = select(store.getState()); if (nextState !== currentState) { currentState = nextState; onChange(currentState); } }

let unsubscribe = store.subscribe(handleChange); handleChange(); return unsubscribe; }

https://github.com/reduxjs/redux/issues/303#issuecomment-125184409

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

'onChange' event is getting called only once in react
this.handleChange('checked') creates a handler function, handleChange = name => event => { rather than being the handler function itself ...
Read more >
React handleChange() function explained - handle single
The handleChange() function that you see in many React component examples is a regular function created to handle input change. It's commonly ...
Read more >
React onChange Events (With Examples) - Upmostly
The onChange event in React detects when the value of an input element changes. Let's dive into some common examples of how to...
Read more >
How to Handle Multiple Inputs with a Single onChange ...
The onChange handler will listen for any change to the input and fire an ... 2 First name 3 <input 4 type="text" 5...
Read more >
How to use handleChange() function in react component?
An onChange event is triggered when values are entered in the input. This fires a function handleChange(), that is used to set a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found