reactjs - Can't add multiple lines of components into variable -


i want save content in variable depending on result of if statement. when add multiple lines doesn't work.

let content = null if(this.props.group.name != null){   content = <text>just line works</text>               <text>this doesn't work</text> } 

i can't find out do. can't add + @ end of line in javascript.

components need wrapped in parent containing component, unless create array keys.

// work because it's wrapped inside parentheses , has parent component content = (           <view>             <text>just line works</text>             <text>this doesn't work</text>           </view>           )  // works because components array content = [            <text key="1">just line works</text>,            <text key="2">this doesn't work</text>           ] 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -