Created
July 17, 2019 15:45
-
-
Save pocke/b7983a437d93047313e4342c5ef2933e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use key attribute