My Miscellaneous Notes on React

My Miscellaneous Notes on React

React Tooling

Create React App:

  • can select package manager (–use-npm). By default is using yarn as it is also a facebook project
  • has templates (–template typescript / find templates: https://www.npmjs.com/search?q=cra-template-*)
    • cra-template-redux (for Redux)
    • cra-template-typescript (for Typescript)
  • npm start = yarn start

Lot of boilerplates but some are really notable:

CSS / Styling React

  • What is Utility-first CSS? It just feels wrong… Until you try it for yourself! I repeat, you have to try it out to understand it! Why not just write inline styles?

CSS in JS Library

5 Ways to Style React Components in 2020

React Testing

google: How to test container components?

Immediately-invoked Function Expressions (IIFE)

We can assign to a variable a value that’s of function type. The function on the right-hand side of the assignment operator is called a “function expression”. We can have anonymous function expressions; without name. When we don’t have an assignment, we can also force a function to be treated as an expression in a lot of ways: prefixing with void or anything else before function keyword; quite often we just put parentheses.

Source: Mastering Immediately-invoked Function Expressions or JavaScript IIFE

I want to declare and immediately instantiate a class. So the question is: Can we have Immediately Invoked Class Expression (IICE)? It turns out, yes, we can! Just prefix with void new class and that’s that. Read more: IICE

How to remove all node_modules folders

find . -name “node_modules” -type d -prune -exec rm -rf ‘{}’ +

Here is an explanation and run in Windows also: How to delete ALL node_modules folders on your machine?

Hooks as Redux replacement

Use Hooks + Context, not React + Redux

GitHub Student Developer Pack

user: andrea236
pass: PolozitiP110
Connected also with my email: cvladan+gh.andrea@gmail.com 

Learning for free

Great Perks

Noted perks

Free feature flags for students | ConfigCat feature flags GitHub Desktop | Simple collaboration from your desktop

JavaScript Basics

Q: Class vs Object? A: Class is a template for objects and Object is an “instance” of a class. Syntactically we use commas to separate properties and methods in Objects, but in Classes we don’t need them.

Q: Then, what is Object Prototype vs Class? A: Class defines object type which will be instantiated at runtime. Object prototype is itself an object instance already. Therefore, a prototypal inheritance: a prototype is a working object instance and objects inherit directly from other objects.

date 01. Jan 0001 | modified 29. Dec 2023
filename: Learn React » Miscellaneous Notes