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

Commit 742b02b

Browse files
committed
Move back the handling of p tag
1 parent 8a6236f commit 742b02b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/react/component/tags.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,15 @@ def present_as_node(component, *params, &children)
3131

3232
HTML_TAGS.each do |tag|
3333
define_method(tag) do |*params, &children|
34-
React::RenderingContext.render(tag, *params, &children)
34+
if tag == 'p'
35+
if children || params.count == 0 || (params.count == 1 && params.first.is_a?(Hash))
36+
React::RenderingContext.render(tag, *params, &children)
37+
else
38+
Kernel.p(*params)
39+
end
40+
else
41+
React::RenderingContext.render(tag, *params, &children)
42+
end
3543
end
3644
# handle deprecated _as_node style
3745
define_method("#{tag}_as_node") do |*params, &children|

0 commit comments

Comments
 (0)