-
JS this
this is a keyword, it refers to an object, which object-depends on how this is being invoked. in object - refers to the object alone - global object function - global object function - strict mode - undefined event - refers to the HTML element that received by the event call(), apply(), bind() - refers to any object
-
useEffect useLayoutEffect
useEffect runs asynchronously and after a render is painted to the screen (after browser paints the screen). useLayoutEffect, on the other hand, runs synchronously (before the browser paints) after a render but before the screen is updated. This means useLayoutEffect will block the screen update, causing potential performance issues if the effect takes too long.
-
React security
escape variables, react does automatically by {} use HTTPS utitlize dangerouslySetInnerHTML, if used then sanitize HTML(with DOMPurify library) use two factor authentication use the rule of least previlege when interacting with DB
-
React refactor
make resusable components/components breakdown use hooks optimize render - useMemo, useCallback use ESLint, Prettier write unit tests
- Typscript
-
JS closure
Global variables can be made local (private) with closures. It makes it possible for a function to have “private” variables.
- Cybersecurity
- Web perfomance
- Web security
- PostgreSQL
-
TS any vs unknown
any, unknown: allow assigning any type
any: allows being assigned to any type allows calling any method
unknown: doesn’t allow being assigned to any type doesn’t allow calling any method
const a: any = ‘a’; // OK const b: unknown = ‘b’ // OK
const v1: string = a; // OK const v2: string = b; // ERROR const v3: string = b as string; // OK
a.trim() // OK b.trim() // ERROR
-
TS generic types
Generics allow us to create flexible, reusable, and type-safe code by defining type variables instead of explicitly specifying types. Generics allow creating type variables which can be used to create class/function/type aliases. No need to explicitly define types. Makes it easier to write reusable code.
- TS type vs interface
-
TS enum
enum is a special class that represents a group of constants. Enums come in two flavors string and numeric.
-
TS Aliases
Allow defining types with a custom name.
-
TS Interface
Interfaces are similar to type aliases, except they only apply to object types.
-
TS Tuple
A tuple is a typed array with a pre-defined length and types for each index.
-
TS type vs interface
Types in TypeScript are more flexible and can define primitive, intersection, union, tuple, or different types of data, while interfaces are used to describe the shape of an object.
-
JS/ES6+
-
API Security
- Authentication - username/password. 2FA.
- Authorization - RBAC, access only to the authorized roles.
- Rate Limiting - Protect from brute-force/DOS attacks.
- Use tokens - JWT is good for maintaining user sessions.
- Error Handling - expose specific and short comprehensive error message. don’t expose too much info.
- Input Validation - Protect from SQL injection, XSS attacks.
- Use HTTPS - this encrypts the data between the client and the server.
- Hide Sensitive Information - hide keys, secrets.
- Update dependencies - to get latest security patches.
- REST API Client Server Arcitecture Stateless Cacheable Uniform Interface Layered System Code on Demand (optional)
-
relational/non-relaional db - mongoDB
-
web3, IPFS
-
Rust
-
Bash/shell scripting
-
terraform
-
vector db
-
semantic search tech - elastic