You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
275 B
10 lines
275 B
2 years ago
|
const buildObjectStateSetterCallback =
|
||
|
<S extends Record<string, unknown>>(key: keyof S, value: S[keyof S]) =>
|
||
|
({ [key]: toReplace, ...restPrevious }: S): S =>
|
||
|
({
|
||
|
...restPrevious,
|
||
|
[key]: value,
|
||
|
} as S);
|
||
|
|
||
|
export default buildObjectStateSetterCallback;
|