DEV Community

Discussion on: Using the React Context API, the right way (a time saver)

Collapse
 
khoan profile image
khoan • Edited

wow, first time I come across this expression: <>{ condition ? children : null }. What's its name? Thanks.

Collapse
 
itays123 profile image
Itay Schechner

Ternaty operator
When you put it inside a React fragment, you ensure that the function will always return JSX.

Collapse
 
khoan profile image
khoan

ah, I think, it should be: <>{ condition ? children : null }</>

Or, the closing </> is optional? Thanks.

Thread Thread
 
itays123 profile image
Itay Schechner

Yeah, you should close it. I'd review my code snippets again next time.