Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 033f819

Browse files
committed
call if only for <p>
1 parent f3a86f7 commit 033f819

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

lib/react/component/tags.rb

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,21 @@ def present(component, *params, &children)
3939

4040

4141
HTML_TAGS.each do |tag|
42-
define_method(tag) do |*params, &children|
43-
if tag == 'p'
42+
if tag == 'p'
43+
define_method(tag) do |*params, &children|
4444
if children || params.count == 0 || (params.count == 1 && params.first.is_a?(Hash))
4545
React::RenderingContext.render(tag, *params, &children)
4646
else
4747
Kernel.p(*params)
4848
end
49-
else
50-
React::RenderingContext.render(tag, *params, &children)
5149
end
52-
end
53-
if tag != :div
54-
alias_method tag.upcase, tag
55-
const_set tag.upcase, tag
5650
else
57-
alias_method tag.upcase, tag
58-
#const_set tag.upcase, React.create_element(tag)
59-
#Object.const_set tag.upcase, Class.new(HtmlTagWrapper)
51+
define_method(tag) do |*params, &children|
52+
React::RenderingContext.render(tag, *params, &children)
53+
end
6054
end
55+
alias_method tag.upcase, tag
56+
const_set tag.upcase, tag
6157
end
6258

6359
def self.html_tag_class_for(tag)

0 commit comments

Comments
 (0)