What is component in React JS?
Component is a block of the code which allows us to split the UI into independent, reusable pieces and each component is isolated.
A react component is a javascript function which takes input ( called as props ) and returns React elements which describes what should appear on UI screen/page.
React element represents DOM tags
What is functional component in reactJS
Functional component is a javascript function which returns JSX (HTML). Functional component can accepts properties as a paramenter , which will be called as props , which are optional. Functional components can be imported and can be used as a normal HTML tag. Props to the functional component can be passed as attributes as like normal HTML tag attributes.
Creating function component
Here we will see how to create functional component in React JS
We can create javascript function in a javascript file
Post a Comment
Post a Comment