This repository was archived by the owner on Oct 19, 2018. It is now read-only.
This repository was archived by the owner on Oct 19, 2018. It is now read-only.
better syntax for specifying render method #149
Closed
Description
allow the render method to be specified like this:
class Foo < React::Component::Base
render do
div.foo do
"hello".span
"there".span
end
end
end
as an alternative to
class Foo < React::Component::Base
def render
div.foo do
"hello".span
"there".span
end
end
end
Why?
- render methods are very often longer than the 10 lines recommend by style guides. Specifying the render method as a block avoids linter (i.e. rubocop) errors.
- we can now also specify the container as the first parameter, shortening things up:
class Foo < React::Component::Base
render(:div, class: :foo) do
"hello".span
"there".span
end
end
Metadata
Metadata
Assignees
Labels
No labels