Skip to content

Instantly share code, notes, and snippets.

@mazikwyry
Created March 15, 2017 11:01
Show Gist options
  • Save mazikwyry/b7db5934c67872b95409713f1e30cb27 to your computer and use it in GitHub Desktop.
Save mazikwyry/b7db5934c67872b95409713f1e30cb27 to your computer and use it in GitHub Desktop.
class ToDoForm < React::Component::Base
param :add_todo, type: Proc
define_state body: ''
render do
div do
div do
input(type: :text, value: state.body)
.on(:change) { |e| state.body! e.target.value }
end
button { 'Add' }
.on(:click) { params.add_todo(state.body) }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment