Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react native conditional rendering

class Component extends React.Component {
	const a = true
	render() {
      return (
    	<Container>
          {a == true
           ? (<Button/>)
           : null
          }
        </Container>    	
	  )
	}
}

This is staying: if a == true, render a button component. 
Otherwise render null, in other words nothing.
 
PREVIOUS NEXT
Tagged: #react #native #conditional #rendering
ADD COMMENT
Topic
Name
5+6 =