Whoaa512 / react-search

react-search is a simple search box autocomplete component using react.js.
Other
2 stars 0 forks source link

Redux version #1

Open Whoaa512 opened 9 years ago

Whoaa512 commented 9 years ago

It would be awesome if this could be re-written to:

Whoaa512 commented 9 years ago

CC: @StevenIseki, any thoughts about the above?

svnm commented 9 years ago

I will be keen to get some examples of using it with a redux store as you mention, hoping to play around with it tonight.

svnm commented 9 years ago

One thought I did have was to have a redux-search module that was a binding to the react-search component, the redux-search module could possibly be used with other type of view engines, not bound to react.

It could be used with a react-native-search component or possibly riot or mithril. Not sure if many other component libraries are in use with redux at the moment, but something to think about.

svnm commented 9 years ago

Just an update, I'm not sure exactly how a redux-search module would work, as I am still in the early stages of using redux.

I was keen to also make a deku-search component, so if you are using redux you can use either react-search or deku-search for your component. As redux doesn't depend on react or deku it might be useful to have a redux-search module, or possibly just make both components play nicely with redux.

Back on the point of fixing up the matching-items:

To eliminate having the state in the search component for matching items could be eliminated and the props could that are passed in as an array could be a map in the search component

this.props.items [‘ada’, ‘c’, julia]

becomes a map

this.props.items = { 
  item: ‘ada’, matched: false,
  item: ‘c’, matched: true,
  item: ‘julia’, matched: false
}

Also I think we should pass back the items in the callback onChange and onClick. Is this a common way items are passed back from dumb components to containers in redux?