From 0057256bdf1340341da58f1424537ca8620486d9 Mon Sep 17 00:00:00 2001 From: Chetan Nada Date: Wed, 24 May 2023 21:56:23 +0530 Subject: [PATCH] Detailed Answer added with example in Question 218 --- README.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0eec1d3d..5efaf5d6 100644 --- a/README.md +++ b/README.md @@ -4917,13 +4917,25 @@ 218. ### How to pass numbers to React component? - You should be passing the numbers via curly braces({}) where as strings in quotes + We can pass `numbers` as `props` to React component using curly braces `{}` where as `strings` in double quotes `""` or single quotes `''` ```jsx - React.render( - , - document.getElementById("container") - ); + import React from "react"; + const ChildComponent = ({ name, age }) => { + return ( + <> + My Name is {name} and Age is {age} + + ); + }; + const ParentComponent = () => { + return ( + <> + + + ); + }; + export default ParentComponent; ``` **[⬆ Back to Top](#table-of-contents)**