I am a programmer but I hate grammar. Here you will find what I did, doing , will do ... Scattered pieces of knowledge that I have deleted from my mind to the trash bin through out my boring daily coding life. I will also report some of my failures in life so dear to me not success, because I have always learnt much only when I fail.
Thursday, February 16, 2023
What is FC or function component in React ?
"FC" stands for "Functional Component". In React with TypeScript, a functional component is defined as a function that takes in props and returns JSX elements. The type of a functional component is typically defined using the FC type, which is short for FunctionComponent.
For example, here's how you might define a functional component using FC in React with TypeScript:
In this example, MyComponent is a functional component that takes in name and age props of type string and number, respectively. The FC type definition at the top of the component definition tells TypeScript that this is a functional component that takes in props of type Props.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment