symfony new --full my_project # Create empty project symfony (web app)
symfony serve # Start the dev server
| import React from "react" | |
| const Modal = ({ children }: { children: React.ReactNode }) => { | |
| return React.Children.map(children, (child) => { | |
| if (!React.isValidElement(child)) { | |
| return null; | |
| } | |
| React.cloneElement(child); | |
| }); | |
| }; |
| const isArrayEmpty = (arr: unknown[]): boolean => Array.isArray(arr) && !arr.length; | |
| const capitalize = (s: string): string => s.charAt(0).toUpperCase() + s.slice(1); | |
| const isObjectEmpty = (obj: unknown): boolean => obj && Object.keys(obj).length === 0; | |
| const randomInteger = (min: number, max: number): number => Math.floor(Math.random() * (max - min + 1)) + min; | |
| const clamp = (input: number, min: number, max: number): number => input < min ? min : input > max ? max : input |