101 React Tips & Tricks For Beginners To Experts β¨
π https://bit.ly/4cl3SE4
#react #frontend
@ReactDev π
π https://bit.ly/4cl3SE4
#react #frontend
@ReactDev π
DEV Community
101 React Tips & Tricks For Beginners To Experts β¨
I have been working professionally with React for the past +5 years. In this article, I share the...
12 Best JavaScript Animation Libraries to Supercharge Your Web Projects in 2024
π https://bit.ly/3SKd5P6
#javascript #frontend
@ReactDev π
π https://bit.ly/3SKd5P6
#javascript #frontend
@ReactDev π
DEV Community
12 Best JavaScript Animation Libraries to Supercharge Your Web Projects in 2024
Are you ready to take your web designs to the next level? JavaScript animation libraries are the...
How Does The React Compiler Work? βοΈ π€
π https://bit.ly/4crdTzo
#react #frontend
@ReactDev π
π https://bit.ly/4crdTzo
#react #frontend
@ReactDev π
yongseok.me
React Compiler, How Does It Work? [1] - Entry Point through Babel Plugin | μ₯μ©μ λΈλ‘κ·Έ
We aim to deeply explore the React Compiler. Let's start by examining the compiler's entry point through the Babel plugin.
Rev up your Node.js app performance with NGINX reverse proxy β‘οΈ
π https://bit.ly/3Y0ZxSs
#nodejs #performance #backend
@ReactDev π
π https://bit.ly/3Y0ZxSs
#nodejs #performance #backend
@ReactDev π
Medium
Rev up your Node.js
Node.js is a popular runtime environment for developing web applications due to its lightweight, fast, and scalable nature. However, asβ¦
React SPA Lazy Loading Pitfalls βοΈ
You should be lazy loading some of your routes. And if you are, you're probably messing up the data-fetching because it's an easy mistake to make.
π https://bit.ly/3TMjud0
#react #frontend
@ReactDev π
You should be lazy loading some of your routes. And if you are, you're probably messing up the data-fetching because it's an easy mistake to make.
π https://bit.ly/3TMjud0
#react #frontend
@ReactDev π
ReactTraining.com
SPA Lazy Loading Pitfalls
React Corporate Workshops, Training, and Consulting
Using callbacks to achieve better component decoupling in React βοΈ
π https://bit.ly/3TL3EzF
#react #frontend
@ReactDev π
π https://bit.ly/3TL3EzF
#react #frontend
@ReactDev π
darios.blog
Using callbacks to achieve better component decoupling in React
Decouple React components effectively by passing functions the right way, creating more testable and maintainable code.
What is the difference between HTTP 1, HTTP 2 and HTTP 3 π€
π https://youtu.be/UMwQjFzTQXw?feature=shared
#backend
@ReactDev π
π https://youtu.be/UMwQjFzTQXw?feature=shared
#backend
@ReactDev π
YouTube
HTTP 1 Vs HTTP 2 Vs HTTP 3!
Get a Free System Design PDF with 158 pages by subscribing to our weekly newsletter: https://bit.ly/bytebytegoytTopic
Animation tools: Adobe Illustrator and After Effects.
Checkout our bestselling System Design Interview books:
Volume 1: https://amzn.to/3Ou7gkdβ¦
Animation tools: Adobe Illustrator and After Effects.
Checkout our bestselling System Design Interview books:
Volume 1: https://amzn.to/3Ou7gkdβ¦
Top 10 Oh My Zsh Plugins For Productive Developers π
π https://bit.ly/4gWNb5e
#guide #cicd
@ReactDev π
π https://bit.ly/4gWNb5e
#guide #cicd
@ReactDev π
Travis Media
Top 10 Oh My Zsh Plugins For Productive Developers
Zshell is a powerful terminal and popular alternative to bash. Oh My Zsh is an open source fraemework for Zshell with many themes and plugins. In this post, I'll share my top 10 plugins and how they can make developers who use them, more productive.
There are hundreds of custom React hooks to access the local storage out there. But I was tempted to create my own using
This was my first attempt.
Everything seemed to work at first. When I called
After few hours of debugging, I finally reached out to my sometimes-genius-sometimes-idiot companion, the gpt-4o which I am using via Supermaven. It immediately pointed out the problem with the code. At first, I didn't believe its explanation so I asked for the proof by giving me the documentation link. By the way, you should not blindly trust what LLM says. Always verify! Anyway, it gave me the link and once again I learned something new thanks to AI.
So the problem is that the "storage" events are only fired when local storage is changed by a different document, not the document where the change originated. It's properly documented in the MDN docs but I didn't know it. So when I save the value in the local storage from the
Equipped with this knowledge, I was able to fix the code by adding a custom event listener:
This custom hook basically does two things:
1. listens to the storage event and the custom event local-storage-change.
2. sends a custom event local-storage-change after storing the value in the local storage.
I still add the official storage event listener because I want the component to still re-redner when the local storage is changed by another document.
Source: https://bit.ly/4eF3QbX
#react #hooks
@ReactDev π
useSyncExternalStore
since I figured it's the proper hooks for this kind of use case. Now I'm sure there are already a package that does exactly what I want, but I wanted to create it by myself, for the sake of learning.This was my first attempt.
const useLocalStorage = (
key: string,
initialValue: string
) => {
const data = useSyncExternalStore(
(onChange) => {
window.addEventListener("storage", onChange);
return () => {
window.removeEventListener("storage", onChange);
};
},
() => {
const data = localStorage.getItem(key);
return data || initialValue;
},
() => initialValue
);
const setData = useCallback(
(value: string) => {
localStorage.setItem(key, value);
},
[key]
);
return [data, setData] as const;
};
Everything seemed to work at first. When I called
setData
function, the value was persisted in the local storage. But then I noticed that the data value was not updated which didn't re-render the component that used the hook in result. The weird thing was that when I directly modified the value in the local storage, the data value was updated and the component re-rendered. That caused me to think that the change subscription of useSyncExternalStore
wasn indeed working.After few hours of debugging, I finally reached out to my sometimes-genius-sometimes-idiot companion, the gpt-4o which I am using via Supermaven. It immediately pointed out the problem with the code. At first, I didn't believe its explanation so I asked for the proof by giving me the documentation link. By the way, you should not blindly trust what LLM says. Always verify! Anyway, it gave me the link and once again I learned something new thanks to AI.
So the problem is that the "storage" events are only fired when local storage is changed by a different document, not the document where the change originated. It's properly documented in the MDN docs but I didn't know it. So when I save the value in the local storage from the
setData
function, the event is not fired hence the useSyncExternalStore
doesn't return the updated value.Equipped with this knowledge, I was able to fix the code by adding a custom event listener:
const useLocalStorage = (key: string, initialValue?: string | null) => {
const data = useSyncExternalStore(
(onChange) => {
const onStorageEvent = (e: Event) => {
const customEvent = e as CustomEvent;
if (customEvent.detail.key === key) {
onChange();
}
};
window.addEventListener("storage", onChange);
window.addEventListener(
"local-storage-change",
onStorageEvent as EventListener
);
return () => {
window.removeEventListener("storage", onChange);
window.removeEventListener(
"local-storage-change",
onStorageEvent as EventListener
);
};
},
() => {
const data = localStorage.getItem(key);
return data || initialValue;
},
() => initialValue
);
const setData = useCallback(
(value: string) => {
localStorage.setItem(key, value);
window.dispatchEvent(
new CustomEvent("local-storage-change", { detail: { key } })
);
},
[key]
);
return [data, setData] as const;
};
This custom hook basically does two things:
1. listens to the storage event and the custom event local-storage-change.
2. sends a custom event local-storage-change after storing the value in the local storage.
I still add the official storage event listener because I want the component to still re-redner when the local storage is changed by another document.
Source: https://bit.ly/4eF3QbX
#react #hooks
@ReactDev π
Nico's Blog
SSR-friendly Custom React Hook for Local Storage Read and Write
I learned something new about window's storage event!
This media is not supported in your browser
VIEW IN TELEGRAM
New Canva Glow-Up animation is Amazing
Node.js Podcast π’π§
https://open.spotify.com/playlist/5hnQVGbOW4OByGmTOdNREp?si=655a51ab64b74a74
#nodejs
@ReactDev π
https://open.spotify.com/playlist/5hnQVGbOW4OByGmTOdNREp?si=655a51ab64b74a74
#nodejs
@ReactDev π
What are React Server Components? π€βοΈ
Web Dev Simplified
https://youtu.be/rGPpQdbDbwo?feature=shared
#react #frontend
@ReactDev π
Web Dev Simplified
https://youtu.be/rGPpQdbDbwo?feature=shared
#react #frontend
@ReactDev π
YouTube
React Server Components Change Everything
Full Next.js Course: https://reactsimplified.com/?utm_source=youtube&utm_medium=video-description&utm_term=video-id-rGPpQdbDbwo#next-js-course
Server vs Client Components Article: https://blog.webdevsimplified.com/2023-11/react-server-components/?utm_souβ¦
Server vs Client Components Article: https://blog.webdevsimplified.com/2023-11/react-server-components/?utm_souβ¦
React server components from scratch!
https://youtu.be/MaebEqhZR84?feature=shared
#react #frontend
@ReactDev π
https://youtu.be/MaebEqhZR84?feature=shared
#react #frontend
@ReactDev π
YouTube
React server components from scratch!
Repo: https://github.com/bholmesdev/simple-rsc
Let's build a node server, stream an RSC to your browser, and handle client component bundling!
#javascript #programming #reactjs #tutorial
Let's build a node server, stream an RSC to your browser, and handle client component bundling!
#javascript #programming #reactjs #tutorial
All 17 React Best Practices βοΈβ‘οΈ
π https://youtu.be/5r25Y9Vg2P4?feature=shared
#react #frontend
@ReactDev π
π https://youtu.be/5r25Y9Vg2P4?feature=shared
#react #frontend
@ReactDev π
YouTube
All 17 React Best Practices (IMPORTANT!)
π Check out Semaphor: https://semaphor.cloud (paid sponsorship). Disclaimer: this is a sponsored video (paid). It's your responsibility to evaluate safety, accuracy and other relevant parts of the reviewed product.
π NEW React & Next.js Course: https://bβ¦
π NEW React & Next.js Course: https://bβ¦
The True Nature of
π https://bit.ly/4hfQTXH
#react #frontend
@ReactDev π
useActionState
in React βοΈπ https://bit.ly/4hfQTXH
#react #frontend
@ReactDev π
Nikhil S - Blog
The True Nature of useActionState
Unlocking powerful async control and state synchronization for smooth UI transitions