question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSX Support short bool syntax

See original GitHub issue

For next example

<fbt desc="" doNotExtract>Test</fbt>

I get this error:

    TypeError: Cannot read property 'type' of null

      at node_modules/babel-plugin-fbt/FbtUtil.js:140:15
          at Array.forEach (<anonymous>)
      at getOptionsFromAttributes (node_modules/babel-plugin-fbt/FbtUtil.js:130:18)
      at PluginPass.JSXElement (node_modules/babel-plugin-fbt/index.js:153:13)
      at newFn (node_modules/@babel/traverse/lib/visitors.js:193:21)
      at NodePath._call (node_modules/@babel/traverse/lib/path/context.js:53:20)
      at NodePath.call (node_modules/@babel/traverse/lib/path/context.js:40:17)
      at NodePath.visit (node_modules/@babel/traverse/lib/path/context.js:88:12)
      at TraversalContext.visitQueue (node_modules/@babel/traverse/lib/context.js:118:16)
      at TraversalContext.visitSingle (node_modules/@babel/traverse/lib/context.js:90:19)
// this example work fine
<fbt desc="" doNotExtract={true}>Test</fbt>
{
    "babel-plugin-fbt": "^0.9.14",
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jrwatscommented, Oct 17, 2019

OK, you are clear for takeoff 😃 https://github.com/facebookincubator/fbt/issues/84

Try running yarn test from the top-level repo after rebasing

I’d recommend adding some tests using your new syntax similar to: https://github.com/facebookincubator/fbt/blob/9963128994dadbf1f8c362ee13e313f66787df0e/packages/babel-plugin-fbt/__tests__/fbtJsx-test.js#L870-L881

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSX In Depth - React
Fundamentally, JSX just provides syntactic sugar for the React. ... the ES6 object shorthand {foo} which is short for {foo: foo} rather than...
Read more >
How are boolean props used in React? - Stack Overflow
Passing a boolean variable/expression in JSX: ... Are both acceptable? Referring to the way of passing an explicit true vs defaulting a prop...
Read more >
Negated Boolean Prop Shorthand #50 - reactjs/rfcs - GitHub
JSX has a shorthand boolean prop notation, which sets prop to true. Click me! But this feature allows to set props only to...
Read more >
Logical OR (||) - JavaScript - MDN Web Docs - Mozilla
It is typically used with boolean (logical) values. ... Short circuit means that the expr part above is not evaluated, hence any side ......
Read more >
7 Ways to Implement Conditional Rendering in React ...
In JSX, you are able to use JavaScript code with markup to render dynamic values within your application. JSX uses curly braces (...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found