There is a lot of guidance online about defining functions within React.Component objects, but I am having trouble finding best practices for functions within Functional Components. For instance, what are the implications of myFC_1 vs myMC_2 in the typescript code below.
interface Props { name: string};
export const myFC_1: FunctionComponent<Props> = (props:Props) {
function helloWorld(): string {
return "Hello " + props.name;
}
return <div> { helloWorld() }</div>
}
export const myFC_2: FunctionComponent<Props> = (props:Props) {
const helloWorld =():string => {
return "Hello " + props.name;
}
return <div> { helloWorld() }</div>
}