I use React 16.0.
I want to return an element conditionally as shown below.
import React from 'react';
export default class App extends React.PureComponent {
render () {
return [
<div className="a"></div>,
{condition ? <div className="b"></div> : null},
{condition ? <div className="c"></div> : null}
];
}
}
Is there a way to do this without any extra methods or conditional statements outside the return statement?
thank you for reading.