Reputation: 43
I'm building a mini app to get flight dates prices etc using the Ryanair's API.
I have a component to conditionally render 2 other components based on if there are flights on the day or not, but it's not working.
import React from 'react';
import isFlight from './isFlight';
import noFlight from './noFlight';
function FlightCheck({isflight}){
if(isflight === true){
return <isFlight/>;
}
return <noFlight/>;
}
export default FlightCheck;
Upvotes: 4
Views: 99
Reputation: 168
Your component names need to start with a capital letter.
import IsFlight from './isFlight';
import NoFlight from './noFlight';
<IsFlight/>
<NoFlight/>
This is a JSX tag name convention used to differentiate between built in components and custom components. Built in components start with a lowerCase letter, whereas custom components will start with a upperCase letter
Upvotes: 6