import React from 'react';
import ReactDOM from 'react-dom';
class QuoteMaker2 extends React.Component{
render(){
return
( <blockquote>
<p>
What is important now is to recover our senses.
</p>
<cite>
<a target="_blank"
href="https://en.wikipedia.org/wiki/Susan_Sontag">
Susan Sontag
</a>
</cite>
</blockquote>)}
};
const app = document.getElementById('app')
ReactDOM.render(<QuoteMaker2 />, app )
Why doesn’t this work?? The error says that I need to render a
but that’s what I think I’m doing…
import React from 'react';
import ReactDOM from 'react-dom';
class QuoteMakerTwo extends React.Component {
render() {
return (
<blockquote>
<p>
What is important now is to recover our senses.
</p>
<cite>
<a target="_blank"
href="https://en.wikipedia.org/wiki/Susan_Sontag">
Susan Sontag
</a>
</cite>
</blockquote>
);
}
};
ReactDOM.render(
<QuoteMakerTwo />,
document.getElementById('app')
);
import React from 'react';
import ReactDOM from 'react-dom';
class QuoteMaker extends React.Component {
render() {
return (
<blockquote>
<p>
What is important now is to recover our senses.
</p>
<cite>
<a target="_blank" href="https://en.wikipedia.org/wiki/Susan_Sontag">
Susan Sontag
</a>
</cite>
</blockquote>
);
}
};
ReactDOM.render(
<QuoteMaker />,
document.getElementById('app')
);
then the compiler has no way of knowing that this is supposed to be a single statement. It will see the return keyword and immediately exit the method/function ignoring whatever is present within the parentheses.
If you put the opening parenthesis on the same line return (
then the compiler knows that the intent is to return whatever is between the opening and closing parentheses.
holy crap thank you, I was thinking the ■■■■ thing was bugged. But usually when that is the case, its always me miss reading the instructions. You are a lifesaver here.