Open matyasf opened 2 years ago
I have the following code (it's part of a larger function, this is the simplified version):
const aaaa = root.find(j.JSXElement, { openingElement: { name: { type: 'JSXIdentifier', name: "Button" } } }) console.log(aaaa.length) // logs 4 const bbbb = aaaa.find(j.JSXElement, { openingElement: { name: { type: 'JSXIdentifier', name: "Button" } } }) console.log(bbbb.length) // logs 0
The input test file:
let a = ( <p> <Button variant="link" href="#" /> <Button variant="link-inverse" href="#" /> <Button variant="link" /> <Button variant="link-inverse" /> </p> )
Why does the second find call find zero results? It has the same parameters, I'd expect that it logs 4 again.
find
I have the following code (it's part of a larger function, this is the simplified version):
The input test file:
Why does the second
find
call find zero results? It has the same parameters, I'd expect that it logs 4 again.