
JavaScript for PHP Developers
@JSForPHP
Bạn có thể thích
Hey everyone! React v19 has been released! The future is now. react.dev/blog/2024/12/0…
📒 JavaScript Trick - Use the URL constructor When you want to add some query parameters to your URL, use the built-in URL constructor in JavaScript instead of template literals. This results in more readable and less error-prone code as you don't need to manually write ? and &

Just found out that Fetch API has built-in timeout support! 🤯

Incredible post on optimizing JavaScript for performance — so many neat little surprises in here: romgrk.com/posts/optimizi…
My answer: TypeScript's goal is not to be type-safe. It's to provide a type system to describe enough of JavaScript to be useful.
That's an hour of my day I'm never getting back

Async await is super awesome... until it's not and it's not obvious to newer developers. Lint your code, folks.

express is great. It may not be the most modern solution and I'm definitely eyeing alternatives, but it's amazing how useful it's been for the last decade. It's been my companion for as long as I've used node.
❌ Using Boolean to filter `undefined` from a list? Prefer using a type guard which returns a type predicate ✅ instead. #typescript

A common TypeScript mistake I see in React code reviews: Needless useState type arguments. If there's a default, the type can typically be inferred.

Problem: You want to support internationalization. You want autocomplete support for translated strings. You want type safety to ensure translations are available for all languages. Solution: Use TypeScript. Use functions for strings that need placeholders for dynamic content.

I use fetch btw
Mitosis is really neat - write your components in mitosis JSX and it will generate the equivalent React/Svelte/Vue/+more component code. Extremely helpful for large organizations that need to share components / design systems across frameworks mitosis.builder.io/?outputTab=E4U…
🔥 take big, but nicely formatted, dumps in your console with console.table()
🔥 TypeScript Tip 🔥 Creating a Context in React can be pretty annoying in TypeScript. Here's my method for keeping things typesafe, minimizing use of 'as', and also ensuring folks use your custom hooks, instead of useContext.
Why render React Server Components? Performance. 1. Faster fetches. The server typically has a faster internet connection than your users.💨 2. Fetches start sooner (no waiting for JS to parse and render). ⏰ 3. Less JS. React server components add no JS to the bundle. 🔥
🔥 Format large numbers in your JavaScript with numeric separators. const milly = 1_000_000; This doesn't affect how the number works or is displayed - just helpful for reading large values quickly.
JavaScript: The optional chaining operator (?.) accesses an object's property or calls a function. If the object is undefined or null, it returns undefined instead of throwing an error. developer.mozilla.org/en-US/docs/Web…

United States Xu hướng
- 1. $CHA 1,137 posts
- 2. #TORQSports N/A
- 3. Nancy 84.6K posts
- 4. Supreme Court 124K posts
- 5. Argentina 479K posts
- 6. Banish 1,523 posts
- 7. Waddle 4,930 posts
- 8. #PokemonGO 3,855 posts
- 9. Brogdon 5,537 posts
- 10. #TWICExVictoriasSecret 24.6K posts
- 11. SCOTUS 39K posts
- 12. #VSFashionShow 43K posts
- 13. TWICE LIGHTS UP VSFS 24.4K posts
- 14. Olave 4,010 posts
- 15. Big Balls 30.6K posts
- 16. #ClockTower1Year 1,022 posts
- 17. Martha 23K posts
- 18. Biker Boyz N/A
- 19. Voting Rights Act 40.1K posts
- 20. Russ 20.9K posts
Something went wrong.
Something went wrong.