**Tell us what’s happening
I can’t get ReactDOM to render a simple element at CodePen (but it worked in create-react-app). Any help is very much appreciated.
I would suggest to always make sure the component name is capitalized
Try adding the “Input” code below to the Babel compiler and look at the difference in the React.createElement calls in the output of HelloWorld1 and HelloWorld2
Input
function hello(props) {
// Correct! This use of <div> is legitimate because div is a valid HTML tag:
return <div>Hello {props.toWhat}</div>;
}
function Hello(props) {
// Correct! This use of <div> is legitimate because div is a valid HTML tag:
return <div>Hello {props.toWhat}</div>;
}
function HelloWorld1() {
// Correct! React knows <Hello /> is a component because it's capitalized.
return <Hello toWhat="World" />;
}
function HelloWorld2() {
// Wrong! React thinks <hello /> is an HTML tag because it's not capitalized:
return <hello toWhat="World" />;
}
Output
function hello(props) {
// Correct! This use of <div> is legitimate because div is a valid HTML tag:
return /*#__PURE__*/React.createElement("div", null, "Hello ", props.toWhat);
}
function Hello(props) {
// Correct! This use of <div> is legitimate because div is a valid HTML tag:
return /*#__PURE__*/React.createElement("div", null, "Hello ", props.toWhat);
}
function HelloWorld1() {
// Correct! React knows <Hello /> is a component because it's capitalized.
return /*#__PURE__*/React.createElement(Hello, {
toWhat: "World"
});
}
function HelloWorld2() {
// Wrong! React thinks <hello /> is an HTML tag because it's not capitalized:
return /*#__PURE__*/React.createElement("hello", {
toWhat: "World"
});
}