React useState

    0

    1

    Giovanny Gongora

    Codiga's TypeScript Recipes

    return a state array with two values using useState hook

    interface ISettings {
      duration: number
      smart: boolean
      width: WidthProperty<string | number>
      height: HeightProperty<string | number>
    }
    const initialSettings: ISettings = {
      duration: 500,
      smart: true,
      width: '100%',
      height: '100%',
    }
    const [settings, setSettings] = React.useState<ISettings>(initialSettings)
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.