CODE COMPONENT - Using useState causes React error

Hi guys,

I am building a custom form for a client. However, as soon as I add the useState hook, the code component crashes. After adding

const [formState, setFormState] = useState<State>({});

I am getting this error.

The form itself is pretty simple, but quite long. This is the .webflow.tsx file:

import { declareComponent } from "@webflow/react";
import { OrdersForm } from "./OrdersForm";

// Declare the component
const OrdersFormWebflow = declareComponent(OrdersForm, {
  // Component metadata
  name: "Orders Form",
  description: "A form for ordering custom cuts",
  group: "Forms",
  // Prop definitions
  props: {},
  // Optional configuration
  options: {
    applyTagSelectors: true,
    ssr: false,
  },
});

export default OrdersFormWebflow;

Is there something I am missing on export?

Help appreciated.

Cheers,
Slawa

Hi @Slawa , how are you importing useState in your component? If you have a short/abbr. snippet to share that might be helpful! Also, what version of the webflow-cli and verison of React are you using?