This rule warns about a Mitosis limitation.
This rule aims to warn you if you declare a variable with the same name as a state property.
Examples of incorrect code for this rule:
import { useStore } from '@builder.io/mitosis';
export default function MyComponent(props) {
const state = useStore({ text: props.text });
}
Examples of correct code for this rule:
import { useStore } from '@builder.io/mitosis';
export default function MyComponent(props) {
const state = useStore({ text: null });
onMount(() => {
state.text = props.text;
});
}
export default function MyComponent(props) {
const state = useStore({
text: null,
fn1() {
return foo(props.text);
},
fn2() {
return foo({ text: props.text });
}
});
onMount(() => {
state.text = props.text;
});
}