import React, { FC } from "react"; import { createRoot } from "react-dom/client"; import "./index.css"; type UserInputProps = { nationality: string }; // Component to show user details const L3: FC = ({ nationality }) => ( {nationality} ); // Some component #2 const L2: FC = ({ nationality }) => ( ); // Some component #1 const L1: FC = ({ nationality }) => ( ); // Simple styled button type BtnProps = { onClick: () => void; text: string }; const MyBtn: FC = ({ onClick, text }) => ( ); // pretend to be fetch const fetchUser = () => ({ nationality: "Ukrainian" }); // Some component with logic type SomeContainerProps = { onDetailGet: (v: string) => void }; const SomeContainer: FC = ({ onDetailGet }) => { // Performance issue const btnHandler = () => { const userDetails = fetchUser(); onDetailGet(userDetails.nationality); }; return ; }; // Application class App extends React.Component { state = { nationality: "Unknown" }; render() { const { nationality } = this.state; return ( <>

My App

); } setNationality = (v: string) => this.setState({ nationality: v }); } const container = document.getElementById("root"); createRoot(container!).render( );