kev kev - 1 month ago 19
React JSX Question

react-text comments causes invisible line

React Comments like:

`<!-- react-text: 3 -->
<!-- /react-text -->`


get rendered as empty line messing up with the design. Is there any way to prevent this from happening?

Edit: there is
something
between the opening and closing tags. It's not visible in the code above but in the fiddle. I copy pasted both from vim (see screenshot).


https://jsfiddle.net/xokqyyxj/2/

enter image description here

Answer

React has added that block because an empty element was rendered. To remove it you will have to see where that empty element is generated. It is likely it is from an empty string - they can cause these seemingly unnecessary react comment blocks.

Comments