Skip to content

Instantly share code, notes, and snippets.

@garrytan
Last active August 31, 2015 04:06
Show Gist options
  • Select an option

  • Save garrytan/bc00d8146c96473a7e52 to your computer and use it in GitHub Desktop.

Select an option

Save garrytan/bc00d8146c96473a7e52 to your computer and use it in GitHub Desktop.
@ExampleComponent = React.createClass
mixins: [HistoryJSMixin]
# so, in your search field, you can save the state to history and set the URL as well below...
#
search: (toSearch)->
handleResults = (err, content)=>
if content.query == @state.search
@setState(searchResults: content.hits)
@saveState(url: '/foo?bar=foo') # BINGO
# hypothetical search function async call../
@index.search toSearch, {}, handleResults
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment