States

suggest change
# States are read using the 'state' method, and updated using 'mutate'# when states change they cause re-render of all dependent dom elementsclass StateExample < Hyperloop::Componentstate count: 0  # by default states are initialized to nilrender doDIV doSPAN { "Hello There" }A { "Click Me" }.on(:click) { mutate.count(state.count + 1) }DIV do"You have clicked me #{state.count} #{'time'.pluralize(state.count)}"end unless state.count == 0endendend

Note that states can be shared between components using Hyperloop::Stores

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Integrating React.js with Rails using Hyperloop:
*States

Table Of Contents
55CSV
66Integrating React.js with Rails using Hyperloop