I\'m trying to return multiple React elements from a helper method. I could solve it simply by moving around some code, but I\'m wondering if there\'s a cleaner way to solve
Try this:
class Foo extends React.Component {
_renderAuthor() {
return {this.props.author}
}
render() {
return (
{this.props.title}
{this.props.author && " by "}
{this.props.author && this._renderAuthor()}
);
}
}