I'm trying to learn react and webpack. I have the following file called Banner2.js with the content:
import React from 'react';
export default class Banner2 extends React.Component{
render() {
return (
<h2>Banner 2</h2>
{this.showPara()}
);
}
showPara()
{
return (<p><span>This is text</span></p>);
}
}
When I run the webpack command line, I get the error message:
ERROR in ./src/Components/Banner2.js Module build failed: SyntaxError: /var/www/html/wp/src/Components/Banner2.js: Unexpected token (11:3) return (
Banner 2
{this.showPara()} );
What did I do wrong? I just want the output of the showPara() function to show up in the render function.