Cannot read property 'match' of undefined using array destructuring
staeke opened this issue · 2 comments
staeke commented
This code
const [a,{b}] useState([0,{}])
fails with Cannot read property 'match' of undefined
. It's because of the somewhat simplistic AST traversal in src/backend/helpers.ts
, line 128. This line:
if (el.match(/_use/)) hooksNames[el] = statements[i + 1];
I could a submit a PR, but don't fully understand the code, and thought you'd probably do it better.
Thanks anyhow!
kevinfey commented
Hi staeke - can You link to the repo where You're having this issue?
lind-tania commented
Hi,
The traversal function was updated in version 7 of Reactime.