Closed aeciorc closed 4 years ago
I've noticed that when the state is initialized as a class property (rather than in the constructor), it's ignored by stateful-to-stateless. For example:
class Foo extends React.Component { state = { vixe: 1, oxe: "bla" }; render() { } }
becomes
const Foo = props => {};
instead of
const Foo = props => { const [vixe, setVixe] = useState(1); const [oxe, setOxe] = useState("bla"); };
This PR adds a simple fix
I've noticed that when the state is initialized as a class property (rather than in the constructor), it's ignored by stateful-to-stateless. For example:
becomes
instead of
This PR adds a simple fix