How to avoid extra wrapping
in React?

前端 未结 10 1053
孤独总比滥情好
孤独总比滥情好 2020-12-02 12:04

Today I have started learning ReactJS and after an hour faced with the problem.. I want to insert a component which has two rows inside a div on the page.A simplified exampl

10条回答
  •  囚心锁ツ
    2020-12-02 12:08

    Here is one way to render "transculent" components:

    import React from 'react'
    
    const Show = (props) => {
      if (props.if || false) {
        return ({props.children})
      }
      return '';
    };
    
    ----
    
    
    
        
        

    Yoamama

提交回复
热议问题