Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 617 Bytes

use-state-var-declarator.md

File metadata and controls

31 lines (22 loc) · 617 Bytes

use-state-var-declarator (use-state-var-declarator)

This rule warns about a Mitosis limitation.

Rule Details

This rule aims to warn you if you assign useStore() to a variable named anything other than state.

Examples of incorrect code for this rule:

export default function MyComponent(props) {
  const a = useStore();

  return <div />;
}

Examples of correct code for this rule:

export default function MyComponent(props) {
  const state = useStore();
  return <div />;
}

export default function MyComponent(props) {
  const [name, setName] = useState();
  return <div />;
}