examples/todoapp/application.rb in opal-react-0.0.4 vs examples/todoapp/application.rb in opal-react-0.0.5
- old
+ new
@@ -21,12 +21,14 @@
end
def handleSubmit(e)
e.preventDefault()
now = Time.now
- nextItems = state[:items] + [{ text: state[:text], id: now.to_i * 1e6 + now.usec }]
- nextText = ''
- set_state({items: nextItems, text: nextText})
+ new_item = [{ text: state[:text], id: now.to_i * 1e6 + now.usec }]
+ set_state(
+ items: state[:items] + new_item,
+ text: ''
+ )
end
def render
div([
h3('TODO'),