Open samijaber opened 2 years ago
yeah this is needed. the workaround is not using function declareation.
export const usePrevious = () => {};
We should change the warning to throw an error, or at least improve the warning: "Could not parse export: ignoring..."
https://github.com/BuilderIO/mitosis/blob/7b5d4c9396c975b3af5ab83734622347cd546862/packages/core/src/parsers/jsx.ts#L1009
We are hitting this warning in our snapshot tests for React when running for this snapshot: https://github.com/BuilderIO/mitosis/blob/7b5d4c9396c975b3af5ab83734622347cd546862/packages/core/src/__tests__/data/basic-ref-usePrevious.raw.tsx#L7
Looking at the logic: https://github.com/BuilderIO/mitosis/blob/7b5d4c9396c975b3af5ab83734622347cd546862/packages/core/src/parsers/jsx.ts#L982-L1010
This is not accounting for
node.declaration
being aFunctionDeclaration