You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I discovered jsx-slack v2 can use asynchronous component as following:
constAsyncComponent=async({ userId })=>{// Fetch some dataconstname=awaitgetUserName({id: userId})return<Section>Hello, {name}!</Section>};(async()=>{console.log(<Blocks><Context>Asynchronous component example</Context><Divider/>{await<AsyncComponentuserId={123}/>}</Blocks>)})()
TypeScript requires to cast the component into any type.
This usage was found out by chance and it's out of our specification, but may have a worth to write down to the documentation as one of the useful way to use async functions.
The text was updated successfully, but these errors were encountered:
Hey! We're using jsx-slack in our project, and was wondering if this was possible on current version? The workaround we found for now is calling components as functions, but that's kind of ugly to do
I discovered jsx-slack v2 can use asynchronous component as following:
TypeScript requires to cast the component into
any
type.This usage was found out by chance and it's out of our specification, but may have a worth to write down to the documentation as one of the useful way to use async functions.
The text was updated successfully, but these errors were encountered: