Skip to content

Instantly share code, notes, and snippets.

@mazikwyry
Last active March 15, 2017 11:26
Show Gist options
  • Save mazikwyry/8880f972be4eda8764e117e00985787c to your computer and use it in GitHub Desktop.
Save mazikwyry/8880f972be4eda8764e117e00985787c to your computer and use it in GitHub Desktop.
class ToDoBox < React::Component::Base
param :todos, type: Array
def add_todo(body)
$store.dispatch({
type: :add_todo,
id: 1,
body: body
})
end
render do
div do
h1 { 'Dreams to fulfill' }
ToDoList(todos: todos)
ToDoForm(add_todo: lambda { |body| add_todo(body) }) #Method Object
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment