Skip to content

Instantly share code, notes, and snippets.

@pocke
Created July 17, 2019 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pocke/b7983a437d93047313e4342c5ef2933e to your computer and use it in GitHub Desktop.
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
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