Open/Close AutoSearchInput dropdown with Redux state
See original GitHub issueThe AutoSearchInput component does setState({ autocompleteIsOpen: true | false })
. It should use Redux state instead so that we can use the Redux development tool to work on this component. Beware that setState({ searchValue: '...' })
is still necessary because typing characters in a text box should not dispatch Redux actions.
For QA: Please check for regressions in the autcomplete functionality of the search box in the header
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (11 by maintainers)
Top Results From Across the Web
ReactJs - Redux State is not updating in a dropdown in the ...
I am trying to update the items in my dropdown as my state updates with players BUT I am failing. Please help. In...
Read more >Redux Fundamentals, Part 3: State, Actions, and Reducers
The official Redux Fundamentals tutorial: learn how reducers update state in response to actions.
Read more >Store - Redux
Store. A store holds the whole state tree of your application. The only way to change the state inside it is to dispatch...
Read more >Redux Fundamentals, Part 5: UI and React
Since this component needs both of them, we can select the entire state.filters object. As we mentioned earlier, we could put all the...
Read more >Redux FAQ: Organizing State
Others prefer to keep non-critical or UI state, such as “is this dropdown currently open”, inside a component's internal state.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
To me, this logic (open/close) belongs to the component because it is a pure UI piece of information.
I was thinking that when commenting/talking to @SeanPrashad but wasn’t 100% sure and was admittedly half-occupied with other stuff 😅
Also given it already needs to use
setState
I think it’s okay to leave out of Redux. The devtools are handy but we already don’t store absolutely everything in Redux (usually in cases like this) so I think it’s okay to not store it here either.That said, I’m guilty of putting UI stuff in Redux too, so you could use my actions to argue against my words 🤷♂️