Shan Asif (@codewithshan) header
Shan Asif (@codewithshan) profile picture

Software Engineer | Full Stack Developer | Technical Content Developer

Joined March 2013
Photo by Shan Asif (@codewithshan)Photo by Shan Asif (@codewithshan)Photo by Shan Asif (@codewithshan)Photo by Shan Asif (@codewithshan)Photo by Shan Asif (@codewithshan)Photo by Shan Asif (@codewithshan)Photo by Shan Asif (@codewithshan)Photo by Shan Asif (@codewithshan)Photo by Shan Asif (@codewithshan)Photo by Shan Asif (@codewithshan)
When a technology gets a bad reputation but still powers a huge portion of the web (like PHP), it creates a space where: โฌ‡๏ธ
1
1
444
Optimistic vs. Pessimistic Updates in ReactJS: Which is Your Approach? ๐Ÿค” Optimistic Updates: Swift and Engaging โ†’ With optimistic updates, you can update the UI immediately, assuming the operation will succeed. โ†’ Seamless user experience, as changes are instantly reflected. โ†’ If an error occurs, the UI gracefully reverts, ensuring data integrity. Pessimistic Updates: Prioritizing Data Consistency โ†’ For uncertain or critical operations, pessimistic updates shine. โ†’ By waiting for server confirmation, the UI remains unchanged until success is confirmed. โ†’ This approach ensures data integrity, making the server the single source of truth. The Right Choice? ๐Ÿ’ก When deciding between the two approaches, consider the likelihood of success and the importance of data consistency. ๐Ÿ’กOptimistic updates provide responsiveness, while pessimistic updates prioritize integrity. #javascript #reactjs #nextjs
1
498
NextJS Tip โšก Better Website Optimization with Smarter Font Management: If you're still using the old manual method of adding links inside the next/head. Stop doing that; instead, utilize next/font, which lets you optimize your fonts easily and efficiently. ๐Ÿ‘‡๐Ÿป #nextjs
1
1
2
254
โšก๏ธ Check Active Links & Sub-Links in NextJS โ†’ You can use usePathname() to determine if a link is active. โ†’ Check if the current pathname matches the href of the link OR the sub-link Follow @codewithshan (ReactJS / NextJS - Tips & Simplified Code Snippets) . . . #nextjs
1
1
14
169
โš›๏ธ How to structure and organize a React application ( ) โ†“
53
631
15
3,705
342,610
JavaScript Tip โšก Rest Parameter ๐Ÿš€ It bundles the passing arguments into an array ๐Ÿ˜ฎ It allows calling a function with any number of arguments. ๐Ÿคฏ Rest parameter must be the last formal parameter ๐Ÿ˜Ž You can also call it a rest Operator
JavaScript Tip โšก reverse() array method ๐Ÿ’ฅ It reverses and mutates an array. ๐Ÿš€ Returns reversed array. โ“ What do you think will be the output?
Routing in NextJS is super easy โšก ๐Ÿคฏ It has a file-based router built on the concept of pages. ๐Ÿ˜Ž When you add a file to the pages directory, it's automatically available as a route. ๐Ÿ˜€ Any file (react component) inside pages will consider as a route
1
1
Core Benefits of โšก NextJS ๐Ÿ˜ Great for SEO | Google will Love You ๐Ÿ˜Ž Super-Fast User Experience ๐Ÿ˜ฎ Static Generation | Server-Side Rendering ๐Ÿคฉ Perfect for JAMStack ๐Ÿคฏ Easy to learn if you're a ReactJS Developer ๐Ÿ˜ฑ Pre-Rendering | Image Optimization and much more
JavaScript Tip โšก some() array method ๐Ÿš€ If any single element passes the test (returns true) ๐Ÿคฏ On an empty array, it will return false for any condition!
JavaScript Tip โšก every() array method ๐Ÿš€ If any single element doesn't pass the test (returns false) ๐Ÿคฏ On an empty array, it will return true for any condition!
JavaScript Tip โšก replace() vs replaceAll() ๐Ÿ’ฅ replace() - first appearance of text and replace it (Use regex to replace all) ๐Ÿš€ Returns a new string and doesn't change the original ๐Ÿ”ฅ replaceAll() - All appearance of text and replace
JavaScript Tip โšก reverse() array method ๐Ÿ’ฅ It reverses and mutates an array. ๐Ÿš€ Returns reversed array โ“ What do you think will be the output?
Tool Tip โšก Thunder Client (VS Code Extension) Start testing APIs right inside VS Code. ๐ŸŒŽ Hand-crafted lightweight Rest Client for Testing APIs ๐Ÿ”— Alternatively, you can use Rest Client (VS Code extension) โ“ What do you mostly use for API Testing (Postman or VS Code)?
1
1
JavaScript Tip โšก Spread Operator ๐Ÿคฏ Spread Operator was introduced in ES6 ๐Ÿ˜Ž You can use it with an iterable array or object ๐Ÿ’ฅ It allows expanding an array into its components ๐Ÿš€ It helps in the concatenation of an array or object properties
1
2
JavaScript Tip โšก Rest Parameter ๐Ÿš€ It bundles the passing arguments into an array ๐Ÿ˜ฎ It allows calling a function with any number of arguments. ๐Ÿคฏ Rest parameter must be the last formal parameter ๐Ÿ˜Ž You can also call it a rest Operator
CSS Tip โšก Responsive iframe ๐Ÿ‘ฉโ€๐Ÿ’ป When you try to embed YouTube videos, you end up on a non-responsive iframe. ๐Ÿ’Ž Outside wrapper for the iframe is important ๐Ÿ’ฅ Remove static width and height ๐Ÿ“ Put class on an iframe to handle the positioning
Stay focused and productive๐Ÿ‘‡ ๐Ÿ‘ฉโ€๐Ÿ’ป Set goals for the day and break them down into smaller tasks. ๐Ÿ“ Organize your files/folders. ๐Ÿ’ป Track your workday and progress. โŒš Set a time limit for each task. ๐Ÿฅณ Take breaks to avoid getting overwhelmed. ๐ŸŽ Reward yourself.
4 standard naming conventions used in modern software development are as follows. Each one defines the specific goal in languages. ๐Ÿ”ฅ Camel: "camelCase" ๐Ÿ Snake: "snake_case" ๐Ÿข Kebab: "kebab-case" ๐Ÿ”‘ Pascal: "PascalCase" Which one do you use the most?
2
1
CSS Tip โšก BEM ๐Ÿ’ฅ Block Element Modifier (A naming convention) ๐Ÿš€ It helps you to create reusable components (Modular) ๐Ÿ”ฅ Makes your front-end code easier to read and understand ๐Ÿ’Ž Low Specificity ๐Ÿ‘‹ Use it with CSS preprocessor like Sass โ“ Your recent use-case of BEM