refactor: move createState to twenty-ui (#4716)
Split from https://github.com/twentyhq/twenty/pull/4518 Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
export * from './components';
|
||||
export * from './display';
|
||||
export * from './theme';
|
||||
export * from './utilities';
|
||||
|
||||
1
packages/twenty-ui/src/utilities/index.ts
Normal file
1
packages/twenty-ui/src/utilities/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './state/utils/createState';
|
||||
18
packages/twenty-ui/src/utilities/state/utils/createState.ts
Normal file
18
packages/twenty-ui/src/utilities/state/utils/createState.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { atom, AtomEffect } from 'recoil';
|
||||
|
||||
export const createState = <ValueType>({
|
||||
key,
|
||||
defaultValue,
|
||||
effects,
|
||||
}: {
|
||||
key: string;
|
||||
defaultValue: ValueType;
|
||||
effects?: ReadonlyArray<AtomEffect<ValueType>>;
|
||||
}) => {
|
||||
const recoilState = atom<ValueType>({
|
||||
key,
|
||||
default: defaultValue,
|
||||
effects,
|
||||
});
|
||||
return recoilState;
|
||||
};
|
||||
Reference in New Issue
Block a user