@builder.io/mitosis
Version:
Write components once, run everywhere. Compiles to Vue, React, Solid, and Liquid. Import code from Figma and Builder.io
18 lines (17 loc) • 733 B
TypeScript
import { MitosisComponent, MitosisState } from '../../types/mitosis-component';
import { ObjectExpression } from '@babel/types';
/**
* Convert state identifiers from React hooks format to the state.* format Mitosis needs
* e.g.
* text -> state.text
* setText(...) -> state.text = ...
*
* This also applies to components that use both useState and useStore.
* e.g.
* const [foo, setFoo] = useState(1)
* const store = useStore({
* bar() { return foo } // becomes bar() { return state.foo }
* })`
*/
export declare function mapStateIdentifiers(json: MitosisComponent, stateProperties: string[]): void;
export declare const parseStateObjectToMitosisState: (object: ObjectExpression, isState?: boolean) => MitosisState;