Skip to content

Instantly share code, notes, and snippets.

@pocke
Created July 17, 2019 15:45
Show Gist options
  • Select an option

  • Save pocke/b7983a437d93047313e4342c5ef2933e to your computer and use it in GitHub Desktop.

Select an option

Save pocke/b7983a437d93047313e4342c5ef2933e to your computer and use it in GitHub Desktop.
require 'ovto'
class MyApp < Ovto::App
class State < Ovto::State
item :next_node, default: false
end
class Actions < Ovto::Actions
def enable_next_node
return {next_node: true}
end
end
class MainComponent < Ovto::Component
def render
# It should display 1 and 2, but actually it displays 1 twice
o 'div', oncreate: -> { actions.enable_next_node } do
o 'div', oncreate: -> { p 2 } if state.next_node
o 'div', oncreate: -> { p 1 }
end
end
end
end
MyApp.run(id: 'ovto')
@pocke
Copy link
Copy Markdown
Author

pocke commented Jul 17, 2019

Use key attribute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment