Do not respond to components

I am creating a gadget to get prices for dates, etc. using the Ryanair API.

I have a component that conditionally displays 2 other components based on whether there are flights per day or not, but it does not work.

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; 
+5
source share
1 answer

The names of your components must begin with a capital letter.

 import IsFlight from './isFlight'; import NoFlight from './noFlight'; <IsFlight/> <NoFlight/> 

This is the JSX tag naming convention used to distinguish between built-in components and custom components. Inline components begin with lowerCase, while custom components begin with upperCase

+7
source

Source: https://habr.com/ru/post/1270723/


All Articles