React.js Notes
374 subscribers
72 photos
4 files
48 links
Welcome :)
Public React Notes
Download Telegram
Instead of using libs for envs, you can use this simple type-safe variant and forget about envs validation.

The post from this tweet Click hereπŸ”—
πŸ₯°1πŸ†1
πŸŽ‰ react-emoji-toggle-button is available now!
A lightweight and customizable emoji picker built for modern React applications.

✨ Key Features:
βœ… Light & Dark Themes
βœ… English & Arabic UI Support
βœ… Recent & Flag Emojis
βœ… Filter Bad Emojis
βœ… Fully Customizable Styles & Sizes
βœ… Easy Integration with any input field

Perfect for chat apps, comment sections, and any interactive UI that deserves an expressive touch! πŸ’¬πŸ’›

🌐 Live Demo:
https://mahmoud-walid.github.io/react-emoji-toggle-button/

πŸ“¦ Install via npm:
npm i react-emoji-toggle-button

πŸ”— GitHub:
https://github.com/Mahmoud-walid/react-emoji-toggle-button

If you like it, don’t forget to ⭐️ the repo and share it with fellow developers! πŸ™Œ

Bring emojis to life in your app today! πŸ§‘β€πŸ’»πŸš€
❀3πŸ₯°1πŸŽ‰1
πŸ”₯2
πŸ” React has its own MurmurHash3 implementation… and it’s hidden in plain sight!

Inside the React source code, there's a little gem of an implementation tucked away in createFastHashJS.js. This file contain a pure JavaScript, Sync, non-cryptographic hashing function based on MurmurHash3 (32-bit).

export function createFastHashJS(key: string): number {
return murmurhash3_32_gc(key, 0);
}


❓Why does React need this ?
React uses this fast hash internally β€”- for example, to hash key paths used in useActionState when handling MPA-style from submissions.
These hashes are used to track state transitions, cache component branches, or generate unique keys.

❓Why not use Web Crypto?
The browser’s crypto.subtle.digest() is asynchronous, which makes it unsuitable in React performance-critical paths where synchronous execution is essential to avoid choppy renders and high context-switching costs.

βœ… MurmurHash3: The best choice
This version comes from Gary Court's highly respected JS port of the MurmurHash3 algorithm.

πŸ“¦ Use Cases in environments like React.
- Component key path hashing.
- Action state deduplication.
- Deterministic memoization cache keys.
- Static asset naming (in build tools).
- ID generation in SSR contexts.

πŸ” Important warning
This hash is not cryptographically secure. It’s optimized for speed and determinism, not protection. Don’t use it for passwords, tokens, or anything sensitive!

β€”β€”β€”β€”β€”β€”-

✨ This is one of those internal utilities that reminds us: even in massive projects like React, simplicity often wins when performance is king πŸ‘‘

β€”β€”β€”β€”β€”β€”-

πŸ”—Links
createFastHashJS.js
MurmurHash
❀2πŸ†1