I'm trying to render multiple child components depending on state however I'm only able to return one child component (SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag)
Each child component passes the same props, how could this code be kept DRY?
Works
export default ({changeState, myState, handleClick}) => ( <Navigation> <span>Navigation</span> <button onClick={() => changeState()}>Navigation</button> { myState ? <NavigationItem handleClick={handleClick} title={'#Link-1'} /> : null } </Navigation> ) Don't
export default ({changeState, myState, handleClick}) => ( <Navigation> <h1>Navigation</h1> <button onClick={() => changeState()}>Navigation</button> { myState ? <NavigationItem handleClick={handleClick} title={'#Link-1'} /> <NavigationItem handleClick={handleClick} title={'#Link-2'} /> <NavigationItem handleClick={handleClick} title={'#Link-3'} /> : null } </Navigation> )