Let’s create a simple React app with multiple components and change the code a bit:
Let’s add a function to get the birth year of the person in the People component.
The separate function is called when the People component is rendered. That function is nothing but a helper function.
How does the function get the age of the person?
The function inside the component has access to all the props that are passed to the component itself and that’s why we don’t need to specifically pass it into the function.
components examples functions props