Hacker News new | ask | show | jobs
by vkjv 3964 days ago
"If you find yourself duplicating/synchronizing state between a child and parent component, then move that state out of the child component completely."

I have exactly one exception to this rule and I would love is someone could provide a recommended way to not make it an exception. Debouncing. For example, if you have a input field that lets you type a number for pagination, debouncing the change of that value with the displayed copy of it.

This is implemented with a debounced input field type that uses props to get and update the value, but maintains it's own state for what is displayed. It uses `componentWillReceiveProps` to stay in sync.

EDIT:

After re-reading, it looks like the author uses this exact same exception for the "select". This is considered UI state and should be fine.