Entradas

Mostrando las entradas etiquetadas como const vs finction

1. React cheat sheet. Component (class or const). Hooks. Function array.reduce

 1. Create a react application in VStudio npx create-react-app my-app --template typescript cd my-app npm i -D bootstrap 2. Components definition and referencing (const, function, and class)  2.1 Defining import React from ' react ' interface Props { text: String ok?: boolean i?: number handleChange?: (e: React.ChangeEvent<HTMLInputElement>) => void } // As consts (4 versions) export const Comp1 : React.FC<Props> = ({text}) => <h1>Component 1 with JSX {text}</h1> export const Comp2 : React.FC<Props> = (props) => <h1>Component 2 with JSX {props.text}</h1> export const Comp3 = (props: Props) => { return (<h1>Component 3 with JSX {props.text}</h1>)} export const Comp4 = ({text}:Props) => <h1>Component 4 with JSX {text}</h1> //As function (1 version) export default function Comp5 ({text}: Props) { return <h1>Component 5 with JSX {text}</h1...