Post #96
1.29K

Методы выборки данных с помощью React
https://blog.openreplay.com/data-fetching-techniques-with-react
✍️ @React_lib
https://blog.openreplay.com/data-fetching-techniques-with-react
✍️ @React_lib
- 👍 5
RE @react_lib
Showing posts older than #97 · Back to latest








React.ComponentProps.
import { ComponentProps } from "react";
import { ExternalComponent } from "external-lib";
type InternalComponentProps = ComponentProps<typeof ExternalComponent> & {
outerClassName: string;
};
- React.MouseEventHandler. Используется для типизации колбека события мыши.
import { MouseEventHandler, } from "react";
type ComponentProps = {
caption: string;
onClick: MouseEventHandler<HTMLButtonElement>;
};
const Component = (props: ComponentProps) => (
<div>
<button onClick={props.onClick}>{props.caption}</button>
</div>
);
type ComponentProps = Pick<Something, "propA" | "propB" | "children"> & {
wrapperClassName?: string;
}
export const Component = (props: ComponentProps) => (
…
); 



