Code inside Playground doesn't accept anonymous async arrow functions.
See original GitHub issueBug Report
Describe the bug
If code inside the Playground Component contains an async arrow function, a syntax error overlay is shown on top the rendered component, but the component renders normally.
Renders error overlay
when
didMount={async val => {console.log('Oh hai Mark'); }}
Works as expected
when
didMount={async function(component) => {console.log('Hai'); })
To Reproduce
- Go to any mdx file
- Inside <Playground> place an async function
- See error overlay
Example Code :
<Playground>
<Component
initialState={{dataLoadingStatus: "loading", chartData:[]}}
didMount={async (component) => {}}
>
Oh hai !
</Component>
</Playground>
Environment
- OS: OSX 10.13.4
- Node/npm version: Node 9.11
Additional context/Screenshots
It’s not a big problem since it can be easily solved by replacing the arrow function with a function as shown in the screenshot, but might be good to know !
Cheers !
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Syntax for an async arrow function - javascript - Stack Overflow
Async arrow functions look like this for multiple arguments passed to it: const foo = async (evt, ... Using async function in a...
Read more >Async/Await Error Handling - Beginner JavaScript - Wes Bos
Go into our playground and copy the async-await.html file and rename it to async-await-error-handling.html . Go and delete everything except for these two ......
Read more >Functions - TypeScript: Handbook
To begin, just as in JavaScript, TypeScript functions can be created both as a named function or as an anonymous function. This allows...
Read more >async function expression - JavaScript - MDN Web Docs
Copy to Clipboard. Async functions can also be defined with the arrow syntax. ... Can be omitted, in which case the function is...
Read more >space-before-function-paren - Pluggable JavaScript Linter
Style guides may require a space after the function keyword for anonymous ... The string option does not check async arrow function expressions...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Does this issue have any progress?
Fixed in v2