Skip to content

Instantly share code, notes, and snippets.

@feifanzhou
Created January 7, 2015 21:59
Show Gist options
  • Save feifanzhou/151104817096e236acf0 to your computer and use it in GitHub Desktop.
Save feifanzhou/151104817096e236acf0 to your computer and use it in GitHub Desktop.
Invoking React component method outside of component
Root = React.createClass
search: ->
query = document.getElementById('searchbar').value
# Do search with query
r = Root({ … })
React.renderComponent(r, document.getElementById('content'))
$('body').on('change', '#searchbar', r.search)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment