Help with ReactCSSTransitionGroup

Help with ReactCSSTransitionGroup
0.0 0


I am trying to make the text fade in/out when the user clicks, using ReactCSSTransitionGroup. The texts are stored in an array. Please let me know if you can help!

/*Fade-in/out... not working yet*/
.fade-enter {
  opacity: 0.01;

.fade-enter.fade-enter-active {
  opacity: 1;
  transition: 500ms ease-in all;

.fade-leave {
  opacity: 1;

.fade-leave.fade-leave-active {
  opacity: 0.01;
  transition: 300ms ease-in all;

  //Set the state with a new text, based on index
  handleClick = (i) => {
        this.setState({ clickedText: texts[i] });

   const { clickedText } = this.state;
          {, i) => (
              {/* Heading */}
              <li id = "name" className = "body"><h1>Jennifer Grace</h1></li>
              <li className = "body"><h2>Front-End Developer</h2></li>

              {/* Fade-in text... not working yet */}
                {/* Text to fade in/out */}
              <li className = "body" key={`text-${i}`}>{t}</li> 

Project is here, if that’s easier to view:



I have tried to use it, too. but I think it is too much trouble. Furthermore, you will have a hard time integrating it in Codepen. Best way, in my mind, is to useClassNames, which practically allows you to duplicate addClass and removeClass from jQuery. This means that you can have your element styled with class

    width: 100px;
    height: 100px;
    background: red;
    -webkit-transition: opacity 2s; /* For Safari 3.1 to 6.0 */
    transition: opacity 2s;

and then, when you want your fading to start, add the following class

  opacity: 0.1;

Adding them together produces the fading effect. Still, classNames is difficult to integrate in Codepen (if you can do it, let me know).


Thank you for the feedback! I thought it was just me.