React JSX Component and Await
问题 I have an async/await function of which I want to use the result to conditionally render a jsx component in my React native application. This a class method that returns a promise. The method has async declared. The problem is I want to use the result of this to conditionally render some jsx. const hasEdit = await perms.has('/page', 'edit'); return ( <div> { hasEdit && <Button icon='pencil' text='EDIT' onTouchTap={ () => { props.onEdit(); } } /> } </div> ) This returns: A valid React element