CSS tip: Use the <picture> tag for responsive images.
It lets you serve different images for different screen sizes, improving performance and layout control.
Frontend devs be careful with XSS.
Avoid dangerouslySetInnerHTML unless absolutely necessary, and never render raw HTML without proper validation/sanitization.
Security starts at the UI layer too.
Happy coding!
๐React's New Hook: useOptimistic()
React is leveling up the developer experience with a powerful new addition - useOptimistic().
If your app deals with instant Ul updates, form submissions, or slow network actions, this one's a game changer.
Happy Coding!
Always build with scalability in mind.
A simple example: design your form using a fields array instead of hard-coding every new field.
Small choices today save big refactors tomorrow.
Git Tip๐ก
You can use git stash command to temporarily save changes that are not yet ready to be committed.
This is handy when you need to switch branches or pull updates but want to save your current work without committing it.
Syntax:
arr.flat([depth])
arr: The array to be flattened.
depth (optional): The level of nesting to flatten. It defaults to 1 if not provided. To flatten all levels of nesting, you can pass Infinity.