This components are used in case there are no use of states (and variable data to handle). A functional component is not preferred in case of data management is done in the component, Like definind a state which holds name, regno ,phone no, email etc., But it is useful if it is used to perform a single operation of single task example menu bar, ad bar.
Sample code. (Inside a react app folder in src folder)
import React from 'react'
export default function function_name(parameters_passed_as_pops) {
return (
)
}
or
import React from 'react'
const function_name(parameters_passed_as_pops) {
return (
)
}
export default function_name
We write the code inside the return block to output the display.
React is coded using jsx which is similar to html but it is modified JavaScript which allows html attributes to make a complete page using react.
JSX is a react extinction.
This is a basic how to make a structure of a component the jsx code in learned in next posts.