I am trying to get the following code working:
class HelloWorld < React::Component::Base
# stuff
def render
div { "hello" }
div { "goodby" }
end
end
but I keep getting this error:
Exception raised while rendering #<HelloWorld:0x489>
RuntimeError: a components render method must generate and return exactly 1 element or a string
React.rb components (like react.js) can only render a single root dom element.
To generate multiple elements you need to wrap the elements in a div, for example: