- Last 7 days
-
docdrop.org docdrop.orgUntitled5
-
omen’slackoflegalstatusaspersons wasactuallyacommonfeaturealwaysbeusedinthepluraltoemphasizeitsdiversity.inmanyoftheworld’s writtenlaw codes,whichhavesometimesregarded{ndividuals andgroupshavechallengedorrejectedgenderhierarchieswomenasaformofproperty.
Another way to say government hadn't seen women as human beings!!!!!!
-
uglywomendid notneedtofearalossofhonorandsodinotmerit protection.
they thought of ugly women as so much less of a being and not to even care for their honor because of their looks??????
-
while in others men or women risk severe punishment or death simplyby being present in a space assigned to the other sex.
now that is absolutely insane and i hadn't known that was a thing that existed.
-
began to add the word “male” for the first time becausewomen had attempted to interpret the existing word “person” to includewomen and to vote as long as they had the required amount of property.
To make action towards changing your wording just to spite people trying to be active members of society is crazy to me.
-
orth America, for example, women were often describede Sex,” as if men did not have any. This sense that one group is anked or default category (i.e., that in the case of gender one is alwaysae a man unless noted otherwise, as in “woman doctor”) has also3S 2 ee of ow subordinate groups.
I had always noticed that women were always gendered when written about but never realized that it was to think that men didn't even fall into the category. As if a doctor could only be seen as a man and to say that they were a women because thats not the ordinary.
-
- Aug 2024
-
github.com github.com
-
This seems to be more than just a thin wrapper like https://github.com/rainerschuster/final-form-material-ui was. I kind of prefer the simplicity of focus of final-form-material-ui.
This appears to be attempting to do too much. Though if it gives you exactly what you want, great.
-
-
github.com github.com
-
mui.com mui.com
Tags
Annotators
URL
-
- Jul 2024
-
react.dev react.dev
-
After your component is removed from the DOM, React will run your cleanup function
- the 'cleanup function' is the return of
setup
. - 'cleanup函数'是setup返回的。
- the 'cleanup function' is the return of
-
-
-
Barcode Writer in Pure JavaScript
-
- Jun 2024
-
legacy.reactjs.org legacy.reactjs.org
-
Keys
diff算法中关于key的两个问题
1.如果列表元素中不指定key属性,会有什么问题?
1.1 如果从列表尾增加元素直接插入,如果从列表头增加元素就需要重新构建整个列表元素子树。(从非尾部操作会导致后续一致的部分无法复用,会有一定的性能问题)
1.2 如果插入两个类型一致,值一致的节点,在删除时,会同时删除两个节点。
2.如果列表元素中用idx作为key属性,会有什么问题?
2.1 从非列表尾部操作(增、删、改)会导致渲染错误。
2.1.1 增:最后一个元素显示两次
2.1.2 删:最后一个元素不显示
2.1.3 改:改了没效果
-
The developer can hint at which child elements may be stable across different renders with a key prop.
开发者可以用key属性标记在不同渲染中哪些子元素是可能稳定的
-
-
-
- openai use LiveKit to deliver realtime voice
- playground: https://cloud.livekit.io/projects/
-
-
react.dev react.dev
-
cause the chat to re-connect every time the component re-renders
because, before, it was depending on only 'roomId' and 'serverUrl', if they didn't change, it will not re-connect. but now, when 'onReceiveMessage' function is included in the dependency array, it will re-connect when re-rendered, because it's a new function every time.
Tags
Annotators
URL
-
- May 2024
- Apr 2024
-
github.com github.com
-
For React 18 onwards, this library have been deprecated and should be replaced with
@testing-library/react
.
-
- Mar 2024
-
docdrop.org docdrop.org
-
Résumé de la vidéo [00:00:04][^1^][1] - [00:09:22][^2^][2]:
La vidéo aborde les stratégies pour gérer les enfants avec TDAH et troubles oppositionnels, en mettant l'accent sur le renforcement positif, la motivation, et la gestion des routines quotidiennes. Elle souligne l'importance de préserver les liens affectifs et de prioriser l'autonomie de l'enfant sur les devoirs scolaires.
Points forts: + [00:00:04][^3^][3] Gestion du TDAH * Stratégies pour les enfants * Renforcement positif + [00:01:32][^4^][4] Importance des liens affectifs * Plus importants que les devoirs * Préservation du lien parent-enfant + [00:03:32][^5^][5] Autonomie de l'enfant * Priorité sur les devoirs scolaires * Importance de la vie sociale + [00:04:41][^6^][6] Stratégies pour les routines * Gérer les oppositions quotidiennes * Valorisation et lâcher-prise
-
-
docdrop.org docdrop.org
-
Résumé de la vidéo [00:00:03][^1^][1] - [00:20:32][^2^][2]:
La vidéo aborde le trouble du déficit de l'attention avec hyperactivité (TDAH), en déconstruisant les idées reçues et en discutant des approches d'évaluation, de diagnostic, et de prise en charge, tant pour les garçons que pour les filles.
Points forts: + [00:00:14][^3^][3] Déconstruction des idées reçues * Importance de l'évaluation avant le diagnostic * Impact des mythes sur la prise en charge + [00:03:30][^4^][4] Surdiagnostic et prévalence du TDAH * Distinction entre augmentation des diagnostics et prévalence stable * Importance de l'évaluation pour la détection + [00:07:08][^5^][5] TDAH chez les filles * Évolution de la représentation du TDAH chez les filles * Influence des biais de genre sur le diagnostic + [00:11:59][^6^][6] Prise en charge scolaire * Formation des enseignants et autonomie des élèves * Efficacité des interventions explicites + [00:16:37][^7^][7] Rôle de l'éducation parentale * Impact de l'environnement familial sur le TDAH * Importance de l'accompagnement parental Résumé de la vidéo [00:20:33][^1^][1] - [00:22:00][^2^][2]:
La partie 2 de la vidéo aborde la nécessité d'une collaboration entre les parents et les professionnels pour réparer les problèmes comportementaux, en utilisant l'analogie d'une voiture nécessitant des réparations régulières. Il souligne l'importance de l'information et de la formation pour éviter les idées reçues et les biais cognitifs, en particulier en ce qui concerne le TDAH et les comportements tyranniques.
Points forts: + [00:20:33][^3^][3] Collaboration nécessaire * Comparaison avec la réparation d'une voiture * Importance de l'implication parentale + [00:21:02][^4^][4] Éviter les idées reçues * Importance de l'information et de la formation * Attention aux biais cognitifs + [00:21:47][^5^][5] Comportements tyranniques * Ne pas créer de nouvelles idées fausses * Développer des approches d'accompagnement
Tags
Annotators
URL
-
-
news.hada.io news.hada.io
Tags
Annotators
URL
-
-
docdrop.org docdrop.org
-
Résumé de la vidéo [00:00:03][^1^][1] - [00:08:29][^2^][2]:
La vidéo présente des stratégies pour les parents confrontés au burn-out parental, en particulier dans des situations familiales complexes comme les familles monoparentales ou recomposées. Elle aborde la gestion de la violence à la maison, l'importance de l'acceptation et du lâcher-prise, ainsi que l'adaptation des méthodes éducatives selon les circonstances.
Points clés: + [00:00:06][^3^][3] Gestion de la violence * Importance du contrôle de soi * Non-violence dans l'éducation + [00:00:49][^4^][4] Familles monoparentales * Liberté dans les choix éducatifs * Avancement personnel + [00:01:17][^5^][5] Réseau de soutien * Difficultés de communication * Importance du soutien extérieur + [00:02:04][^6^][6] Divergences dans le couple * Gestion des désaccords * Adaptation des stratégies + [00:03:01][^7^][7] Changement de modèle éducatif * Exploration de nouvelles méthodes * Évitement des escalades de conflits + [00:04:01][^8^][8] Conséquences de la permissivité * Limites de la non-frustration * Nécessité de structure et de limites + [00:05:01][^9^][9] Décisions et énergie * Importance du rythme personnel * Adaptation au changement + [00:06:26][^10^][10] Temporalité variable * Individualité des expériences * Non-culpabilisation des parents
-
-
docdrop.org docdrop.org
-
Résumé de la vidéo [00:00:04][^1^][1] - [00:29:52][^2^][2]:
Cette vidéo explore le burn-out parental, un trouble du spectre du stress caractérisé par un épuisement physique et psychique, une distanciation émotionnelle, une perte de plaisir et un contraste marqué entre le parent d'avant et celui devenu. Les recherches récentes en Belgique ont mis en lumière ce phénomène, soulignant l'importance de l'équilibre entre les stresseurs et les ressources disponibles pour les parents.
Points clés: + [00:00:11][^3^][3] Définition du burn-out * Maladie du stress * Études sur la parentalité + [00:01:03][^4^][4] Recherches en Belgique * Études sur le burn-out parental * Importance de l'équilibre stress-ressources + [00:02:01][^5^][5] Symptômes du burn-out parental * Épuisement extrême * Distanciation émotionnelle + [00:03:16][^6^][6] Conséquences sur la famille * Impact sur les enfants * Risque pour le couple + [00:10:38][^7^][7] Facteurs de stress ordinaires * Stress lié à la parentalité * Événements imprévus + [00:13:16][^8^][8] Prévalence chez les mères * Plus fréquent chez les femmes * Charge parentale inégale
-
-
docdrop.org docdrop.org
-
Résumé de la vidéo [00:00:04][^1^][1] - [00:23:41][^2^][2]:
La vidéo présente une conférence sur les défis de la parentalité au 21e siècle, notamment l'épuisement parental et l'impact du handicap sur les familles. L'oratrice, avec plus de 30 ans d'expertise dans la surdité infantile, explore l'évolution de la parentalité à travers les siècles, les attentes sociétales actuelles envers les parents, et offre des pistes pour retrouver le plaisir d'être parent.
Points forts: + [00:00:09][^3^][3] Introduction de la conférencière * Expertise en surdité infantile * Intérêt pour le fonctionnement familial + [00:03:17][^4^][4] Structure de la présentation * Parentalité à travers les siècles * Définition du burnout parental * Pistes pour le plaisir parental + [00:03:39][^5^][5] Le métier de parent * Le plus précieux et difficile * Connotations et émotions positives + [00:10:14][^6^][6] Parentalité du 21e siècle * Mutation sociologique * Pression nouvelle * Complexité accrue + [00:17:35][^7^][7] Montée des valeurs individualistes * Impact sur le développement des enfants * Pression sur le couple parental + [00:22:13][^8^][8] Hyper parentalité et ses dérives * Surprotection et contrôle excessif * Impact sur l'autonomie des enfants
-
-
docdrop.org docdrop.org
-
Résumé de la vidéo [00:00:00][^1^][1] - [00:25:43][^2^][2]:
Cette vidéo présente une conférence de Sophie JANOIS sur les résultats de l'étude REACT, menée au CHU de Montpellier, concernant les besoins cliniques des situations de tyrannie familiale sévère. Elle aborde les limites des thérapies familiales classiques et l'importance de la résistance non-violente dans le traitement.
Points forts: + [00:00:11][^3^][3] Présentation de l'étude REACT * Résultats publiés récemment + [00:01:00][^4^][4] Comprendre les besoins cliniques * Situations fréquentes mais peu étudiées + [00:02:04][^5^][5] Limites de l'offre de soins * Thérapies existantes insuffisantes + [00:03:01][^6^][6] Résistance non-violente * Approche alternative prometteuse + [00:11:25][^7^][7] Étude randomisée * Comparaison avec traitement usuel + [00:20:57][^8^][8] Résultats et perspectives * Améliorations continues observées
-
-
docdrop.org docdrop.org
-
Résumé de la vidéo [00:00:00][^1^][1] - [00:19:25][^2^][2]:
La vidéo présente une avocate spécialisée dans la défense des enfants atteints de troubles neurodéveloppementaux. Elle explique son approche flexible en droit pour s'adapter aux besoins spécifiques de ses clients, souvent confrontés à des diagnostics erronés et à des prises en charge inadaptées. Elle souligne l'importance de lutter contre la stigmatisation et de promouvoir des soins adaptés, en mettant l'accent sur la formation des professionnels et l'écoute des parents.
Points forts: + [00:00:11][^3^][3] Défense des enfants atypiques * Troubles TDAH, TSA * Syndrome d'alcoolisation fœtale + [00:01:00][^4^][4] Flexibilité en droit * Droit diversifié * Centré sur le neurodéveloppement + [00:02:01][^5^][5] Lutte contre les diagnostics erronés * Responsabilité médicale * Prises en charge inadaptées + [00:03:02][^6^][6] Droits des handicapés * Allocations via MDPH * Prise en charge adaptée + [00:04:01][^7^][7] Importance de l'accompagnement humain * AESH individuels * Besoin d'attention soutenue + [00:05:03][^8^][8] Contentieux en droit administratif * Éducation nationale * Conseils de discipline + [00:07:00][^9^][9] Responsabilité pénale des jeunes * Discernement * Alternatives à la prison + [00:09:01][^10^][10] Protection de l'enfance * Formations obsolètes * Importance du diagnostic + [00:11:01][^11^][11] Rôle des parents * Observations parentales * Collaboration avec professionnels + [00:12:01][^12^][12] Risques de placement abusif * Informations préoccupantes * Mesures administratives + [00:15:46][^13^][13] Assistance éducative * Évaluations sociales et psychologiques * Importance des soins adaptés + [00:17:00][^14^][14] Départ des CMP * Risque d'IP pour défaut de soins * Importance de la prise en charge en libéral + [00:19:00][^15^][15] Écoute des parents * Non-toxicité * Besoin de répit, pas de retrait Video summary [00:20:00][^1^][1] - [00:39:54][^2^][2]:
La vidéo présente une avocate spécialisée dans la défense des enfants avec des troubles neurodéveloppementaux. Elle explique son approche flexible en droit pour s'adapter aux besoins spécifiques de ses clients et aborde les défis liés à la responsabilité médicale, les droits des handicapés, et la protection de l'enfance.
Highlights: + [00:20:00][^3^][3] Défense des enfants * Troubles neurodéveloppementaux * Flexibilité en droit + [00:21:01][^4^][4] Responsabilité médicale * Diagnostics inadaptés * Culpabilisation des parents + [00:22:26][^5^][5] Droits des handicapés * Allocations via MDPH * Prise en charge adaptée + [00:24:02][^6^][6] Protection de l'enfance * Évaluation des besoins * Formations pour professionnels + [00:27:44][^7^][7] Enjeux du placement * Impact sur les familles * Importance du diagnostic + [00:30:03][^8^][8] Rôle du juge des enfants * Lien entre services et familles * Compréhension des troubles
-
- Nov 2023
-
-
-
useInterval( () => { if (typeof window !== "undefined" && window.google) { setGoogle(window.google); setGoogleIsLoading(false); } }, googleIsLoading ? 100 : null );
-
- Sep 2023
-
reactrouter.com reactrouter.com
-
You'll only need the trailing * when there is another <Routes> somewhere in that route's descendant tree. In that case, the descendant <Routes> will match on the portion of the pathname that remains (see the previous example for what this looks like in practice).
Something to do with routes in index.js and routes in app.js
-
- Aug 2023
-
www.npmjs.com www.npmjs.com
-
well-written
-
- May 2023
-
zh-hans.react.dev zh-hans.react.dev
-
你可能以为当你勾选复选框的时候 state 会被重置,但它并没有!这是因为 两个 <Counter /> 标签被渲染在了相同的位置。 React 不知道你的函数里是如何进行条件判断的,它只会“看到”你返回的树。在这两种情况下,App 组件都会返回一个包裹着 <Counter /> 作为第一个子组件的 div。这就是 React 认为它们是 同一个 <Counter /> 的原因。
React 组件更新机制 tip 1
-
- Apr 2023
-
codeberg.org codeberg.org
-
manter um estado local em uma função de um compo-nente funcional
Um Hook em React Native é uma função que permite que um componente funcional tenha um estado interno e execute efeitos colaterais, sem a necessidade de criar componentes de classe.
O useState é um dos Hooks mais utilizados Ele permite manter um estado local em uma função de um componente funcional. Para usá-lo, declara-se uma variável e uma função de atualização de estado usando o useState Hook
-
-
react.dev react.dev
-
The state is only initialized during the first render.
Anti pattern: Initializing state with prop
This is a common example of redundant state
Tags
Annotators
URL
-
-
vite-remix-router.vercel.app vite-remix-router.vercel.app
Tags
Annotators
URL
-
- Mar 2023
-
www.npmjs.com www.npmjs.com
Tags
Annotators
URL
-
-
www.youtube.com www.youtube.com
-
-
www.infoxicator.com www.infoxicator.com
-
-
reactrouter.com reactrouter.com
-
codesandbox.io codesandbox.io
-
-
tanstack.com tanstack.com
-
-
rolandjitsu.github.io rolandjitsu.github.io
-
www.infoxicator.com www.infoxicator.com
-
www.infoxicator.com www.infoxicator.com
-
```js
export const loader = async () => {
// fire them all at once<br /> const critical1Promise = fetch('/test?text=critical1&delay=250').then(res => res.json()); const critical2Promise = fetch('/test?text=critical2&delay=500').then(res => res.json()); const lazyResolvedPromise = fetch('/test?text=lazyResolved&delay=100').then(res => res.json()); const lazy1Promise = fetch('/test?text=lazy1&delay=500').then(res => res.json()); const lazy2Promise = fetch('/test?text=lazy2&delay=1500').then(res => res.json()); const lazy3Promise = fetch('/test?text=lazy3&delay=2500').then(res => res.json()); const lazyErrorPromise = fetch('/test?text=lazy3&delay=3000').then(res => { throw Error('Oh noo!') });
// await for the response return defer({ critical1: await critical1Promise, critical2: await critical2Promise, lazyResolved: lazyResolvedPromise, lazy1: lazy1Promise, lazy2: lazy2Promise, lazy3: lazy3Promise, lazyError: lazyErrorPromise }) } ```
-
-
www.npmjs.com www.npmjs.com
Tags
Annotators
URL
-
-
www.npmjs.com www.npmjs.com
Tags
Annotators
URL
-
-
tkdodo.eu tkdodo.eu
Tags
Annotators
URL
-
-
codesandbox.io codesandbox.io
Tags
Annotators
URL
-
-
tanstack.com tanstack.com
-
dev.to dev.to
-
tanstack.com tanstack.com
Tags
Annotators
URL
-
-
react-query-v3.tanstack.com react-query-v3.tanstack.comSSR1
Tags
Annotators
URL
-
-
codesandbox.io codesandbox.io
Tags
Annotators
URL
-
-
gatewayapps.github.io gatewayapps.github.io
-
www.npmjs.com www.npmjs.com
-
microsoft.github.io microsoft.github.io
- Feb 2023
- Jan 2023
- Dec 2022
-
-
React JS is a JavaScript library used to create extensible and adaptable user interfaces. Our React development company team of the best React.js / React developers, software engineers, and programmers in India provides custom React development services that handle data updates and synchronization without page reloading, as well as integration with existing applications or systems.
-
React JS development services, an extensible and adaptable JavaScript library for creating user interfaces. Our team of the best React.js / React developers, software engineers, and programmers in India provides custom React js development services.
-
-
qwik.builder.io qwik.builder.io
-
Qwik Tutorials
This is a note, actually I'm just testing how well this works
-
-
blog.nparashuram.com blog.nparashuram.com
-
TL;DR; A custom renderer for ReactJS that uses Web Workers to run the expensive Virtual DOM diffing calculations
-
-
www.zhihu.com www.zhihu.com
-
如何评价 Ant Design 这个项目(一个设计语言)?
Tags
Annotators
URL
-
-
www.zhihu.com www.zhihu.com
-
www.zhihu.com www.zhihu.com
-
为什么社区里那些类 React 库至今没有选择实现 Fiber 架构?
Tags
Annotators
URL
-
-
www.zhihu.com www.zhihu.com
-
如何评价数据流管理架构 Redux?
Tags
Annotators
URL
-
-
www.zhihu.com www.zhihu.com
-
如何理解react componentWillUnmount事件?
Tags
Annotators
URL
-
-
www.zhihu.com www.zhihu.com
-
elm如何既能对状态进行统一管理又能保持分形的呢,在我看来 集中管理 跟 分形 是一对矛盾?
Tags
Annotators
URL
-
-
react.iamkasong.com react.iamkasong.com
-
代码可以看出
test
-
- Nov 2022
-
bvaughn.github.io bvaughn.github.io
-
remix.run remix.run
Tags
Annotators
URL
-
- Oct 2022
-
reactrouter.com reactrouter.com
-
twitter.com twitter.com
- Sep 2022
-
www.bacancytechnology.com www.bacancytechnology.com
-
Hire React Native developer
Hire React Native Developer to build dynamic Android and iOS apps. Our React Native app developers have hands-on experience in working with different projects.
-
-
tkdodo.eu tkdodo.eu
-
remix.run remix.run
Tags
Annotators
URL
-
-
reactrouter.com reactrouter.com
Tags
Annotators
URL
-
-
reactrouter.com reactrouter.com
Tags
Annotators
URL
-
- Aug 2022
-
blog.openreplay.com blog.openreplay.com
-
www.youtube.com www.youtube.com
-
-
gaplo917.github.io gaplo917.github.io
-
github.com github.com
-
The current web developmennt ONLY offload the tasks to web worker when the application encounter performance issues but NOT by the tasks' nature.
-
-
www.thelancet.com www.thelancet.com
-
Chadeau-Hyam, M., Wang, H., Eales, O., Haw, D., Bodinier, B., Whitaker, M., Walters, C. E., Ainslie, K. E. C., Atchison, C., Fronterre, C., Diggle, P. J., Page, A. J., Trotter, A. J., Ashby, D., Barclay, W., Taylor, G., Cooke, G., Ward, H., Darzi, A., … Elliott, P. (2022). SARS-CoV-2 infection and vaccine effectiveness in England (REACT-1): A series of cross-sectional random community surveys. The Lancet Respiratory Medicine, 0(0). https://doi.org/10.1016/S2213-2600(21)00542-7
-
-
Tags
Annotators
URL
-
-
daily-dev-tips.com daily-dev-tips.com
-
And in our case, we want it to keep track of our storage object. So let's also create a usePeristentContext hook.
```js import { useMutation, useQuery, useQueryClient } from 'react-query';
export default function usePersistentContext(key) { const queryClient = useQueryClient();
const { data } = useQuery(key, () => localStorage.getItem(key));
const { mutateAsync: setValue } = useMutation( (value) => localStorage.setItem(key, value), { onMutate: (mutatedData) => { const current = data; queryClient.setQueryData(key, mutatedData); return current; }, onError: (_, __, rollback) => { queryClient.setQueryData(key, rollback); }, } );
return [data, setValue]; } ```
js function SetContext() { const [value, setValue] = usePersistentContext('item_context'); return ( <button onClick={() => setValue(value === 'on' ? 'off' : 'on')}> Click me {value} </button> ); }
-
-
gist.github.com gist.github.com
-
www.youtube.com www.youtube.comYouTube1
-
- Jul 2022
-
dexie.org dexie.org
-
tanstack.com tanstack.com
-
zh-hans.reactjs.org zh-hans.reactjs.org
-
this.handleChange
change事件更新state,也就是用户输入的value,这就是受控组件
-
this.state.value
value随用户输入而改变state
-
-
zh-hans.reactjs.org zh-hans.reactjs.org
-
想要将一个 React 元素渲染到根 DOM 节点中,只需把它们一起传入 ReactDOM.createRoot(): const root = ReactDOM.createRoot( document.getElementById('root') ); const element = <h1>Hello, world</h1>; root.render(element);
createRoot()返回一个ReactDOM对象,该对象具有render方法。
Tags
Annotators
URL
-
-
stackoverflow.com stackoverflow.com
-
React may batch multiple setState() calls into a single update for better performance.
so its not an actual race condition b/w two parallel instructions, but rather just a result of an optimisation performed by react
-
- Jun 2022
-
codesandbox.io codesandbox.io
Tags
Annotators
URL
-
-
techlia.hashnode.dev techlia.hashnode.dev
-
Tags
Annotators
URL
-
-
alexsidorenko.com alexsidorenko.com
-
If the component wrapped with memo re-renders, it means that one of its properties changes.
Tags
Annotators
URL
-
-
dev.to dev.to
-
www.smashingmagazine.com www.smashingmagazine.com
- May 2022
-
casesandberg.github.io casesandberg.github.io
Tags
Annotators
URL
-
-
betterprogramming.pub betterprogramming.pub
-
React Helmet
```js import {Helmet} from "react-helmet";
const Demo = props => ( <br /> <div className="application"> <Helmet> <script src="/path/to/resource.js" type="text/javascript" /> </Helmet> ... </div>
); ```
DOM Method
```js componentDidMount () { const script = document.createElement("script"); script.src = "/path/to/resource.js"; script.async = true; document.body.appendChild(script); }
export const appendScript = (scriptToAppend) => { const script = document.createElement("script"); script.src = scriptToAppend; script.async = true; document.body.appendChild(script); }
class Demo extends React.Component { componentDidMount () { appendScript("/path/to/resource.js"); } } ```
React Hooks
js useEffect(() => { const script = document.createElement('script'); script.src = "/path/to/resource.js"; script.async = true; document.body.appendChild(script); return () => { document.body.removeChild(script); } }, []);
```js import { useEffect } from 'react'; const importScript = resourceUrl=> { useEffect(() => { const script = document.createElement('script'); script.src = resourceUrl; script.async = true; document.body.appendChild(script); return () => { document.body.removeChild(script); } }, [resourceUrl]); };
const Demo = props => { importScript("/path/to/resource.js"); } ```
-
-
www.theodinproject.com www.theodinproject.com
-
asdfasdfasdfasdf
-
-
codesandbox.io codesandbox.io
-
- Mar 2022
-
www.excellentwebworld.com www.excellentwebworld.com
-
So, if you are still in a quandary for your iOS mobile app development, hang on; the blog would throw light on which technology can work like a boon for your project.
-
-
riffle.systems riffle.systems
Tags
Annotators
URL
-
-
aglowiditsolutions.com aglowiditsolutions.com
-
Hire ReactJS Developers
-
-
aglowiditsolutions.com aglowiditsolutions.com
-
Hire React Native Developers
-
-
www.imperial.ac.uk www.imperial.ac.uk
-
Coronavirus infections remain high while Omicron ‘stealth variant’ rises—REACT | Imperial News | Imperial College London. (n.d.). Imperial News. Retrieved 22 March 2022, from https://www.imperial.ac.uk/news/234517/coronavirus-infections-remain-high-while-omicron/
-
-
dunglas.fr dunglas.fr
Tags
Annotators
URL
-
-
react-swipeable-views.com react-swipeable-views.com
Tags
Annotators
URL
-
- Feb 2022
-
dmitripavlutin.com dmitripavlutin.com
-
Clean form code. Pretty elegant + covers best practices. This video also showed me some previously unknown HTML features.
Tags
Annotators
URL
-
-
github.com github.com
-
js queryClient .getQueryCache() .findAll(['partial', 'key']) .forEach(({ queryKey }) => { queryClient.setQueryData(queryKey, newData) })
-
-
www.youtube.com www.youtube.com
-
Title: React with Typescript Crash Course Published: APR/2021 Source: https://www.youtube.com/watch?v=jrKcJxF0lAU
-
-
dhruvnakum.xyz dhruvnakum.xyz
-
twitter.com twitter.com
-
Dr Duncan Robertson. (2022, January 31). Cases will increase today. The way that cases are counted is changing. A short thread. 🧵 https://coronavirus.data.gov.uk/details/whats-new/record/af008739-ffa3-47b8-8efc-ef109f2cfbdd https://t.co/WY655My1RV [Tweet]. @Dr_D_Robertson. https://twitter.com/Dr_D_Robertson/status/1488115542263271427
-
-
www.carlrippon.com www.carlrippon.com
-
www.smashingmagazine.com www.smashingmagazine.com
-
However there are some restrictions: if you are going to use different URLs for GET/PATCH, for example, you have to use the same key, otherwise, React Query will not be able to match these queries.
It is ok to use url as key for React query
-
- Jan 2022
-
lukesmurray.com lukesmurray.com
-
www.nature.com www.nature.com
-
Routen, A., O’Mahoney, L., Ayoubkhani, D., Banerjee, A., Brightling, C., Calvert, M., Chaturvedi, N., Diamond, I., Eggo, R., Elliott, P., Evans, R. A., Haroon, S., Herret, E., O’Hara, M. E., Shafran, R., Stanborough, J., Stephenson, T., Sterne, J., Ward, H., & Khunti, K. (2022). Understanding and tracking the impact of long COVID in the United Kingdom. Nature Medicine, 28(1), 11–15. https://doi.org/10.1038/s41591-021-01591-4
-
-
www.bezkoder.com www.bezkoder.com
Tags
Annotators
URL
-
-
egreb.net egreb.net
-
codesandbox.io codesandbox.io
-
stackblitz.com stackblitz.com
-
-
Wise, J. (2022). Covid-19: One in 23 people in England had infection in early January. BMJ, 376, o222. https://doi.org/10.1136/bmj.o222
-
-
betterprogramming.pub betterprogramming.pub
-
-
An annoying thing about frameworks is when they get too opinonated, which is, in my view, a problem React has.
Tags
Annotators
URL
-
-
github.com github.com
-
Instead of render props, we use Svelte's slot props: // React version <Listbox.Button> {({open, disabled} => /* Something using open and disabled */)} </Listbox.Button> <!--- Svelte version ---> <ListboxButton let:open let:disabled> <!--- Something using open and disabled ---> </ListboxButton>
-
-
tkdodo.eu tkdodo.eu
-
Data Transformation
[…]
3. using the select option
v3 introduced built-in selectors, which can also be used to transform data:
/* select-transformation */ export const useTodosQuery = () => useQuery(['todos'], fetchTodos, { select: (data) => data.map((todo) => todo.name.toUpperCase()), })
selectors will only be called if data exists, so you don't have to care about undefined here. Selectors like the one above will also run on every render, because the functional identity changes (it's an inline function). If your transformation is expensive, you can memoize it either with
useCallback
, or by extracting it to a stable function reference:/* select-memoizations */ const transformTodoNames = (data: Todos) => data.map((todo) => todo.name.toUpperCase()) export const useTodosQuery = () => useQuery(['todos'], fetchTodos, { // ✅ uses a stable function reference select: transformTodoNames, }) export const useTodosQuery = () => useQuery(['todos'], fetchTodos, { // ✅ memoizes with useCallback select: React.useCallback( (data: Todos) => data.map((todo) => todo.name.toUpperCase()), [] ), })
Further, the select option can also be used to subscribe to only parts of the data. This is what makes this approach truly unique. Consider the following example:
/* select-partial-subscriptions */ export const useTodosQuery = (select) => useQuery(['todos'], fetchTodos, { select }) export const useTodosCount = () => useTodosQuery((data) => data.length) export const useTodo = (id) => useTodosQuery((data) => data.find((todo) => todo.id === id))
Here, we've created a
useSelector
like API by passing a custom selector to ouruseTodosQuery
. The custom hooks still works like before, as select will be undefined if you don't pass it, so the whole state will be returned.But if you pass a selector, you are now only subscribed to the result of the selector function. This is quite powerful, because it means that even if we update the name of a todo, our component that only subscribes to the count via
useTodosCount
will not rerender. The count hasn't changed, so react-query can choose to not inform this observer about the update 🥳 (Please note that this is a bit simplified here and technically not entirely true - I will talk in more detail about render optimizations in Part 3).- 🟢 best optimizations
- 🟢 allows for partial subscriptions
- 🟡 structure can be different for every observer
- 🟡 structural sharing is performed twice (I will also talk about this in more detail in Part 3)
-
Data Transformation
[...]
2. In the render function
As advised in Part 1, if you create custom hooks, you can easily do transformations there:
/* render-transformation */ const fetchTodos = async (): Promise<Todos> => { const response = await axios.get('todos') return response.data } export const useTodosQuery = () => { const queryInfo = useQuery(['todos'], fetchTodos) return { ...queryInfo, data: queryInfo.data?.map((todo) => todo.name.toUpperCase()), } }
As it stands, this will not only run every time your fetch function runs, but actually on every render (even those that do not involve data fetching). This is likely not a problem at all, but if it is, you can optimize with
useMemo
. Be careful to define your dependencies as narrow as possible. data inside thequeryInfo
will be referentially stable unless something really changed (in which case you want to recompute your transformation), but thequeryInfo
itself will not. If you addqueryInfo
as your dependency, the transformation will again run on every render:/* useMemo-dependencies */ export const useTodosQuery = () => { const queryInfo = useQuery(['todos'], fetchTodos) return { ...queryInfo, // 🚨 don't do this - the useMemo does nothing at all here! data: React.useMemo( () => queryInfo.data?.map((todo) => todo.name.toUpperCase()), [queryInfo] ), // ✅ correctly memoizes by queryInfo.data data: React.useMemo( () => queryInfo.data?.map((todo) => todo.name.toUpperCase()), [queryInfo.data] ), } }
Especially if you have additional logic in your custom hook to combine with your data transformation, this is a good option. Be aware that data can be potentially undefined, so use optional chaining when working with it.
- 🟢 optimizable via useMemo
- 🟡 exact structure cannot be inspected in the devtools
- 🔴 a bit more convoluted syntax
- 🔴 data can be potentially undefined
-
-
www.sitepoint.com www.sitepoint.com
Tags
Annotators
URL
-
-
-
🤔 So what?
Let’s review a typical Redux process for a fetch operation:
- Dispatch an Action
fetchSomething()
from within the Component - This Action hits the Reducer which will update the store with something like
isLoading: true
- The Component re-renders and displays a loader
- In the meanwhile the Action hits the Middleware which takes care of calling the API
- The API returns the response to the Middleware, which dispatches another Action:
fetchSomethingSucceeded()
when succeeded, orfetchSomethingFailed()
when failed - The succeeded/failed Action hits the Reducer, which updates the
store
- Finally, the response is back to the Component (optionally through a memoized selector) which will show the data
It’s a long process for just a simple fetch, isn’t it?
- Dispatch an Action
-
-
tkdodo.eu tkdodo.eu
- Dec 2021
-
tkdodo.eu tkdodo.eu
Tags
Annotators
URL
-
-
tkdodo.eu tkdodo.eu
Tags
Annotators
URL
-
-
tkdodo.eu tkdodo.eu
-
Increasing StaleTime
React Query comes with a default staleTime of zero. This means that every query will be immediately considered as stale, which means it will refetch when a new subscriber mounts or when the user refocuses the window. It is aimed to keep your data as up-to-date as necessary.
This goal overlaps a lot with WebSockets, which update your data in real-time. Why would I need to refetch at all if I just manually invalidated because the server just told me to do so via a dedicated message?
So if you update all your data via websockets anyways, consider setting a high
staleTime
. In my example, I just usedInfinity
. This means the data will be fetched initially via useQuery, and then always come from the cache. Refetching only happens via the explicit query invalidation.You can best achieve this by setting global query defaults when creating the QueryClient:
const queryClient = new QueryClient({ defaultOptions: { queries: { staleTime: Infinity, }, }, })
-
-
codesandbox.io codesandbox.io
Tags
Annotators
URL
-
-
thewebdev.info thewebdev.info
-
react-query.tanstack.com react-query.tanstack.com
-
blog.theodo.com blog.theodo.com
-
grubersjoe.github.io grubersjoe.github.io
-
github.com github.com
Tags
Annotators
URL
-
-
uiwjs.github.io uiwjs.github.io
Tags
Annotators
URL
-
-
www.digitalocean.com www.digitalocean.com
-
css-tricks.com css-tricks.com
-
remarkjs.github.io remarkjs.github.io
Tags
Annotators
URL
-
- Nov 2021
-
remix.run remix.run
Tags
Annotators
URL
-
-
react-spectrum.adobe.com react-spectrum.adobe.com
Tags
Annotators
URL
-
-
dmitripavlutin.com dmitripavlutin.com
-
{ target: { value } }
This might seem confusing at first glance. However this is just simple "nested destructruing" and "smart function parameters" used together
Read the "Nested Destructuring" and "Smart Function Parameters" sections from the link below to get a better idea of what's going on.
https://javascript.info/destructuring-assignment#object-destructuring
the set() function can also be written as -----
let set = (name) => { return ( (e) => { setDetails( {...details , [ name ] : e.target.value }); console.log(details); }) }
notice how the predeclared variable
name
is being used as a key in the object.{ [name] : value }
NOT{ name : value}
. Skipping the box brackets will throw you an error This is becausename
is actually a variable. Similar to the way in which we useobject[key] = value;
notation to add a k-v pair, we have to use{ [name] : value }
ie. enclose the variable name in square brackets while creating an object using object literal syntax to make sure that the code works
Tags
Annotators
URL
-
- Oct 2021
-
svelte.dev svelte.dev
-
www.youtube.com www.youtube.com
-
React, Airtable, and Netlify
Tags
Annotators
URL
-
-
www.imperial.ac.uk www.imperial.ac.uk
-
Real-time Assessment of Community Transmission findings. (n.d.). Imperial College London. Retrieved August 18, 2021, from http://www.imperial.ac.uk/medicine/research-and-impact/groups/react-study/real-time-assessment-of-community-transmission-findings/
-
- Sep 2021
-
www.sanity.io www.sanity.io
-
React, on the other hand, often requires a fair amount of boilerplate code, even for simple interactions.
-
-
daveceddia.com daveceddia.com
-
redux-thunk does: it is a middleware that looks at every action that passes through the system, and if it’s a function, it calls that function.
-
- Aug 2021
-
alexsidorenko.com alexsidorenko.com
-
All consumers that are descendants of a Provider will re-render whenever the Provider’s value prop changes
Tags
Annotators
URL
-
-
alexsidorenko.com alexsidorenko.com
-
useCallback(fn, deps) is equivalent to useMemo(() => fn, deps).
Tags
Annotators
URL
-
-
blog.isquaredsoftware.com blog.isquaredsoftware.com
-
It's time to put some of these pieces together. We know that: Calling setState() queues a render of that component React recursively renders nested components by default Context providers are given a value by the component that renders them That value normally comes from that parent component's state This means that by default, any state update to a parent component that renders a context provider will cause all of its descendants to re-render anyway, regardless of whether they read the context value or not!.
-
Immutability and Rerendering 🔗︎
This section is gold to use as a teaching example
-
All of these approaches use a comparison technique called "shallow equality". This means checking every individual field in two different objects, and seeing if any of the contents of the objects are a different value. In other words, obj1.a === obj2.a && obj1.b === obj2.b && ......... This is typically a fast process, because === comparisons are very simple for the JS engine to do. So, these three approaches do the equivalent of const shouldRender = !shallowEqual(newProps, prevProps).
-
When trying to improve software performance in general, there are two basic approaches: 1) do the same work faster, and 2) do less work. Optimizing React rendering is primarily about doing less work by skipping rendering components when appropriate.
-
After it has collected the render output from the entire component tree, React will diff the new tree of objects (frequently referred to as the "virtual DOM"), and collects a list of all the changes that need to be applied to make the real DOM look like the current desired output. The diffing and calculation process is known as "reconciliation".
-
-
daveceddia.com daveceddia.com
-
Here’s where immutability comes in: if you’re passing props into a PureComponent, you have to make sure that those props are updated in an immutable way. That means, if they’re objects or arrays, you’ve gotta replace the entire value with a new (modified) object or array. Just like with Bob – kill it off and replace it with a clone. If you modify the internals of an object or array – by changing a property, or pushing a new item, or even modifying an item inside an array – then the object or array is referentially equal to its old self, and a PureComponent will not notice that it has changed, and will not re-render. Weird rendering bugs will ensue.
-
An easy way to optimize a React component for performance is to make it a class, and make it extend React.PureComponent instead of React.Component. This way, the component will only re-render if its state is changed or if its props have changed. It will no longer mindlessly re-render every single time its parent re-renders; it will ONLY re-render if one of its props has changed since the last render.
-
-
daveceddia.com daveceddia.com
-
connect is pure connect automatically makes connected components “pure,” meaning they will only re-render when their props change – a.k.a. when their slice of the Redux state changes. This prevents needless re-renders and keeps your app running fast.
Tags
Annotators
URL
-
-
blog.isquaredsoftware.com blog.isquaredsoftware.com
-
My personal summary is that new context is ready to be used for low frequency unlikely updates (like locale/theme). It's also good to use it in the same way as old context was used. I.e. for static values and then propagate updates through subscriptions. It's not ready to be used as a replacement for all Flux-like state propagation.
-
One problem with the "Context vs Redux" discussions is that people often actually mean "I'm using useReducer to manage my state, and Context to pass down that value". But, they never state that explicitly - they just say "I'm using Context". That's a common cause of the confusion I see, and it's really unfortunate because it helps perpetuate the idea that Context "manages state"
-
We can even say that server caching tools like React-Query, SWR, Apollo, and Urql fit the definition of "state management" - they store initial values based on the fetched data, return the current value via their hooks, allow updates via "server mutations", and notify of changes via re-rendering the component
-
createContext() was designed to solve that problem, so that any update to a value will be seen in child components even if a component in the middle skips rendering.
-
-
kentcdodds.com kentcdodds.com
-
The Redux FAQ has some rules of thumb to help decide whether state should go in Redux, or stay in a component.In addition, if you separate your state by domain (by having multiple domain-specific contexts), then the problem is less pronounced as well.
-
but in a more practical scenario, you often suffer from "death by a thousand cuts" which means that there's not really a single place that's slow, so you wind up applying React.memo everywhere. And when you do that, you have to start using useMemo and useCallback everywhere as well (otherwise you undo all the work you put into React.memo). Each of these optimizations together may solve the problem, but it drastically increases the complexity of your application's code and it actually is less effective at solving the problem than colocating state because React does still need to run through every component from the top to determine whether it should re-render. You'll definitely be running more code with this approach, there's no way around that.
-
-
kentcdodds.com kentcdodds.com
-
I consistently see developers putting all of their state into redux. Not just global application state, but local state as well. This leads to a lot of problems, not the least of which is that when you're maintaining any state interaction, it involves interacting with reducers, action creators/types, and dispatch calls, which ultimately results in having to open many files and trace through the code in your head to figure out what's happening and what impact it has on the rest of the codebase.
-