Nov 2024
Learnings
other
learnings
Learnings.
Table of Contents
- changing a react components' props doesnt cause it to re-render!
- In Javascript maps preserve the order of keys, and are iterable
- Maps can be copied using structuredClone(myMap) which creates a deep copy, just like objects
const myMap = new Map();
const copy = structuredClone(myMap);
- typescript unions logically separate properties from each other and link properties to each other
- components that have their own state are stateful & impure
- HOC is good for separation of concerns (compared to using hooks e.g log click event to a button) https://youtu.be/OLFV1Ds_L8A?t=204
- Role Based Access Control
- in typescript you can use named tuples [arg:Targ,arg2:string]
- ./gradlew --stop && rm -rf ./gradle/caches && ./gradlew clean
- console.log(colors.with(1, 'purple')); // ['red', 'purple', 'green', 'yellow']
- const arr = [1, 2, 3, 4, 5];
- arr.copyWithin(0, 3); // [4, 5, 3, 4, 5]
- https://egghead.io/lessons/react-use-ispending-isloading-and-isfetching-flags-with-react-query
- isPending: there's no data and a query hasn't been finished yet.
- isFetching: the query is being fetched
- isLoading: there's no data, and there's a query currently being fetched. Notice that it's a combination of the above.
You have reached the end of this post. Thank you for reading!