Ash._
Ash._

Reputation: 374

React Component Rendering Empty

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;

Now my output here is: Output

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

Answers (2)

finalfreq
finalfreq

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

Jake Haller-Roby
Jake Haller-Roby

Reputation: 6427

React classes must start with a capital letter. :)

Upvotes: 5

Related Questions