Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 647 Bytes

no-async-methods-on-state.md

File metadata and controls

33 lines (26 loc) · 647 Bytes

no-async-methods-on-state (no-async-methods-on-state)

This rule warns about a Mitosis limitation.

Rule Details

This rule aims to warn you if you use and async method as a value for state property.

Examples of incorrect code for this rule:

export default function MyComponent() {
  const state = useStore({
    async doSomethingAsync(event) {
      return;
    },
  });
}

Examples of correct code for this rule:

export default function MyComponent() {
  const state = useStore({
    doSomethingAsync(event) {
      void (async function () {
        const response = await fetch();
      })();
    },
  });
}