React with Typescript🔗

Intro notes🔗

Component notes🔗

import React , { ComponentProps } from "react";

export const Button ({...rest}): ComponentProps<"button"> = ()=> {
	return (
		<button {...rest}/>
	)
}
type AnyCompProps = React.ComponentProps<typeof AnyComp>

https://stackoverflow.com/a/55220191

Hooks notes🔗

TIL: useState can also take a callback function that contains the current state

<div onClick={() => {

setState((currentState) => ({
	...currentState,
	newKey: 123,
}))/>;