react-live
react-live copied to clipboard
async/await support in live editor
I'm not sure whether async functions should be working in the LiveEditor or not, but when I have that syntax, I get this error in the LiveError:
"SyntaxError: Unexpected identifier"
I couldn't find any documentation or issues regarding this.
EDIT:
It appears this works:
async function loop(next) {
But this syntax does not:
async next => {
Could you provide a repro in Code Sandbox or paste a bit more code here for context? That would help me debug this!
Hey @sofiapoh , I just ran into the same issue. Here is a simple example:
https://codesandbox.io/s/reactliveasyncarrowerror-r74e2?file=/src/App.js
I would like to bump this topic since I have the same issue as @forgo, and really need the async/await support for the internal documentation project :( Does anyone resolve the issue?
Can you try with [email protected]? The code sample above works fine pasted into the online demo: https://react-live.netlify.app/
(using:
() => {
const foo = async() => {
await new Promise(resolve => {
setTimeout(resolve, 1000)
});
};
return <>hi</>;
};
)
@ryan-roemer Is 3.1.1 live? The latest on NPM is 2.4.1, and the example you're using there doesn't work on that version.
@tcc-sejohnson -- Ah! I think it's tagged react-live@next. Can you try that and let us know if that fixes things?
@ryan-roemer Thanks for the quick response :) Yes, that does fix it -- yay! Is it just a prerelease version? Any idea when we can expect 3.1.1 to go live?
@tcc-sejohnson we've re-tagged react-live@latest to be 3.1.1 (thanks for the tag @gksander !)