I'm new to React and I'd like to understand how you can call a component inside another component. I have a component folder which contains a RecipeCard.js:
import React,{Component} from 'react';
import { Ingredients } from './Ingredients';
export class Recipe extends Component {
render() {
return <div class="recipecard">
<p class="texterecipecard">
Recette: {tartetomate.props.name}, <br/>
Difficulté: {tartetomate.props.difficulty},<br/>
Vous aurez besoin de {Ingredients}.<br/> {tartetomate.props.recette}
</p>
</div>;
}
};
const tartetomate = <Recipe name="Tarte tomate" difficulty="Moyenne" ingredients= {Ingredients} recette="Mélanger les ingrédients dans un moule, faire cuire le tout à 190 degrés pendant 20 min." />
When I try to call {Ingredients} inside the render part of my Recipe component, it does not work, there are no errors with eslint but it simply does not render. It leaves a blank. {Ingredients} refers to another component in a Ingredient.js file that simply renders a paragraph.
Why does this not work and how can I make it work?