Posts

Showing posts from April, 2025

Set dynamic input fields in React

 Example for Input type text: const [ videoUrls , setVideoUrls ] = useState ([{ id : 0 , url : '' }]) const addVideoField = () => { setVideoUrls ([ ... videoUrls , { id : videoUrls . length , url : '' }]) } const handleVideoUrlChange = ( id , value ) => { const updatedUrls = videoUrls . map ( video => ( video . id === id ? { ... video , url : value } : video )) setVideoUrls ( updatedUrls ) < div id = '' > < Grid container direction = 'row' alignItems = 'normal' spacing = { 4 } sx = { { pl : 5 , pr : 5 , pt : 3 , pb : 2 } } > < Grid item sm = { 12 } sx = { { pl : 5 , pr : 5 , pt : 3 , pb : 2 } } > { videoUrls . map (( field , ...

Commands for setting up and running a development environment

- yarn nx reset: (Resets the Nx cache, which can help resolve issues with stale builds); - yarn cache clean: (Clears Yarn’s cache to ensure that dependencies are freshly installed) - rm -rf node_modules: (Deletes the node_modules and .yarn directories to remove all installed dependencies and Yarn’s internal files) - yarn install: (Installs the project's dependencies from package.json); - yarn db:docker: (Likely starts a database using Docker (e.g., PostgreSQL, MySQL, or MongoDB); - yarn db:up: (Likely brings up the database container if it's using Docker Compose) - yarn db:dev-migrate: (Runs database migrations for the development environment) - yarn start:dev: (Starts the development server)