Search code examples
ruby-on-rails-4reactjscoffeescriptreact-rails

Mysterious span appearing in HTML for react code


I am using coffeescript with react-rails gem. In the measure.js.coffee, there is no span present in the coffee code, but when the HTML is getting painted a mysterious ghost span is appearing. Below is a screenshot of code and HTML generated by it.enter image description here enter image description here

In my code, there is no span in between carousel-mImages and mtag-images. Is it because of the reactCSSTransitionGroup = React.createFactory(React.addons.CSSTransitionGroup)


Solution

  • Yes, ReactCSSTransitionGroup is a wrapper around ReactTransitionGroup.
    And from the official docs here:

    By default ReactTransitionGroup renders as a span.

    You can change this behavior, and render as another type of component, but this would mean you have to manually configure and render the ReactTransitionGroup.
    This may save you one wrapper element in the DOM, but this depends on your component tree structure.