في حاجه جميلة اوي لسا مكتشقها في js
حته كدا. هتحل مشكله اسمها race condition
لما تعمل fetch
ف زي مايكون الداتا بتسابق بعضها مين يوصل الاول ودا بيعمل مشكله
حته كدا. هتحل مشكله اسمها race condition
لما تعمل fetch
ف زي مايكون الداتا بتسابق بعضها مين يوصل الاول ودا بيعمل مشكله
🥰1
و AbortController دي بتأثر عل البروزر وبس
ملهاش دعوه ب فريم وركس خالص
لانها Browser API يعني
ملهاش دعوه ب فريم وركس خالص
لانها Browser API يعني
تالت حاجه. ريتيرن فانكشن تعمل abort
ودي بيبق اسمها CleanUp function
بعد كل كدا. في ايرور بيظهر
The user aborted a request
ف اعمله ايرور هاندلينج
if (error.name === "AbortError") return;
ودي بيبق اسمها CleanUp function
بعد كل كدا. في ايرور بيظهر
The user aborted a request
ف اعمله ايرور هاندلينج
if (error.name === "AbortError") return;
4 React UI Components Libraries You Should Be Using
Tremor - https://www.tremor.so/components
Radix-UI - https://www.radix-ui.com/
ShadCN - https://ui.shadcn.com
Next UI - https://nextui.org/
Tremor - https://www.tremor.so/components
Radix-UI - https://www.radix-ui.com/
ShadCN - https://ui.shadcn.com
Next UI - https://nextui.org/
❤2🥰1
A very great feature in optional chaining.
Naturally, it is for objects. Check if this property exists or not.
But there is something that will benefit you.
It works with function as well
Like this
callback?.()
If this callback function exists? It will be implemented.
If it is not there. Nothing will happen
Here you will need it when you create a custom hook and pass a function to it as another parameter
and take a look at #rules_of_hooks
https://react.dev/reference/rules/rules-of-hooks
Naturally, it is for objects. Check if this property exists or not.
But there is something that will benefit you.
It works with function as well
Like this
callback?.()
If this callback function exists? It will be implemented.
If it is not there. Nothing will happen
Here you will need it when you create a custom hook and pass a function to it as another parameter
and take a look at #rules_of_hooks
https://react.dev/reference/rules/rules-of-hooks
🔥3❤1
https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-complete-guide-to-react-rendering-behavior/?ref=jonas.io
Complete Guide to React Rendering Behavior
Complete Guide to React Rendering Behavior
Mark's Dev Blog
Blogged Answers: A (Mostly) Complete Guide to React Rendering Behavior
Details on how React rendering behaves, and how use of Context and React-Redux affect rendering
https://angularindepth.com/posts/1008/inside-fiber-in-depth-overview-of-the-new-reconciliation-algorithm-in-react
Inside Fiber: in-depth overview of the new reconciliation algorithm in React
Inside Fiber: in-depth overview of the new reconciliation algorithm in React
Angular.love
Reconciliation algorithm in React - what is it and how it works
Angular.love - a place for all Angular enthusiasts created to inspire and educate.
🔥2
https://thoughtspile.github.io/2021/05/17/everything-about-react-refs/
Everything about React refs
What you should and shouldn't do with useRef
Everything about React refs
What you should and shouldn't do with useRef
Vladimir Klepov as a Coder
So you think you know everything about React refs
https://react.dev/reference/react/useSyncExternalStore
https://twitter.com/sebastienlorber/status/1615329010761842689
useSyncExternalStore ➡️ good way to prevent React hydration issues
⭐And take a look at this⭐️
https://julesblom.com/writing/usesyncexternalstore?ref=jonas.io
https://twitter.com/sebastienlorber/status/1615329010761842689
useSyncExternalStore ➡️ good way to prevent React hydration issues
⭐And take a look at this⭐️
https://julesblom.com/writing/usesyncexternalstore?ref=jonas.io
🥰2🔥1
https://alexsidorenko.com/blog/react-render-always-rerenders/
A Visual Guide to React Rendering - It Always Re-renders
A Visual Guide to React Rendering - It Always Re-renders
Alex Sidorenko
A Visual Guide to React Rendering - It Always Re-renders | Alex Sidorenko
Contrary to popular belief, by default, react component doesn't care whether its props changed or not. It will always re-render when its parent renders.
⭐️Hydration in React⭐️
https://medium.com/@gautamkiran123/hydration-in-react-8e8dff384f93
From here. You will know the difference between CSR and SSR more clearly.
Then we will know what Hydration is.
If HTML content is not rendered beforehand you can’t use
https://medium.com/@gautamkiran123/hydration-in-react-8e8dff384f93
From here. You will know the difference between CSR and SSR more clearly.
Then we will know what Hydration is.
hydrateRoot() API
will compare the rendered content and the server-rendered content and will warn you in case of any mismatches during hydration.If HTML content is not rendered beforehand you can’t use
hydrateRoot()
.In this case , createRoot()
has to be used.createRoot()
returns an object with two methods — render
and unmount
root.unmount()
is mostly useful when the root’s DOM node or any of its ancestors gets removed, we can stop removing everything inside that is related to it by calling the unmount
method. In simple words, we are telling React to stop with removing the React nodes after we have removed what was necessary , by calling unmount()
method.Medium
hydration in React
diving deep into the concept of hydration
🥰2🔥1
⭐️ESlint configuration at React with vite⭐️
When initialize React app with vite
don't forget configure Eslint
And create new file at globally
This file to extend the default rules of ESlint with React rules.
The rules will be like this:
Then, in
import eslint like this:
And add eslint() function inside plugins like this:
After that, ESlint will work at your app (★‿★)
When initialize React app with vite
npm create vite@latest
don't forget configure Eslint
npm install eslint vite-plugin-eslint eslint-config-react-app --save-dev
And create new file at globally
.eslintrc.json
This file to extend the default rules of ESlint with React rules.
The rules will be like this:
{
"extends": "react-app"
}
Then, in
vite.config.js
fileimport eslint like this:
import eslint from "vite-plugin-eslint"
And add eslint() function inside plugins like this:
plugins: [react(), eslint()],
After that, ESlint will work at your app (★‿★)
🥰4👍2