Answer the question
In order to leave comments, you need to log in
How does the render() method work in React?
As far as I know, passing a parameter of this type is not supported in JS. return returns parenthesized html code and not in quotes, and not in ` ` as a string.
Before building, the React compiler parses the data in the component files (namely, those that the render function returns) and translates them into a working form for ES6, or is it normal for ES6. (I understand that react builds everything in ES2015 )
render() {
return (
<Row className="show-grid">
<Col md={6}>
<h2>Est. total</h2>
</Col>
<Col md={6}>
<h2>{`$${this.props.price}`}</h2>
</Col>
</Row>
);
}
Answer the question
In order to leave comments, you need to log in
return returns parenthesized html code
render() {
return (
<h1 className="greeting">
Hello, world!
</h1>
);
}
render() {
return React.createElement(
'h1',
{ className: 'greeting' },
'Hello, world!'
);
}
{
$$typeof: Symbol(react.element),
key: null,
props: { className: "greeting", children: "Hello, world!" },
ref: null,
type: "h1",
_owner: null,
_store: { validated: false },
_self: null,
_source: null,
__proto__: Object,
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question