Reputation: 374
I am having a problem with my react component rendering empty when I try to to use them within another component.
Example:
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
</div>
<p className="App-intro">
<loadMore />
</p>
</div>
);
}
}
class loadMore extends Component {
render() {
return (
<p>Pirate</p>
)
}
}
export default App;
But what I am actually expecting is the <loadmore></loadmore>
tags to be populated with <p>Pirate</p>
but they are just appearing empty, I can't seem to be able to get it to appear.
What have I missed here?
Upvotes: 2
Views: 1639
Reputation: 6980
React expects all components to be capitalized just change loadMore to LoadMore both in the extends class and in the jsx
Upvotes: 2