Developers new to Atlassian Forge often struggle with async functions and promises when making API calls. Learning how to properly use async/await and React-style hooks like useState can simplify handling asynchronous data and UI rendering in Forge apps.

  • Async functions return promises representing future values.
  • Await expressions pause execution until promises resolve.
  • Forge UI kit’s useState hook manages async data-driven UI updates.

What happened

Developers new to Atlassian Forge apps often face confusion when their initial API calls return promises instead of usable data. Async functions in JavaScript return promises, which are placeholders for results available later. Without proper handling using await, the app does not receive the resolved data, leading to errors or unexpected outputs like '[object Promise]'.

This manifests when calling asynchronous APIs inside the Forge app, as the function immediately returns a promise rather than the actual data. Attempting to use the promise directly in app code or UI rendering leads to build failures or runtime errors by misunderstanding how async operations work in modern JavaScript.

Why it matters

Correctly managing asynchronous calls is crucial for Forge developers to build functional apps that reliably fetch and display API data. Async/await syntax provides a cleaner, more readable approach than traditional callbacks, improving code maintainability and error handling.

Forge UI kit hooks, particularly useState, play a key role by tracking asynchronous data changes and triggering UI updates when the awaited promise resolves. This combination ensures dynamic, responsive apps where users see real data instead of placeholder promises, enhancing user experience and trust.

What to watch next

Developers should deepen their knowledge of async/await patterns and explore the broader set of Forge UI kit hooks beyond useState, including those that help manage effectful operations and lifecycle events within Forge apps. Future resources and tutorials focusing on these hooks will further empower efficient asynchronous programming within the Atlassian ecosystem.

Monitoring Atlassian blog updates and community examples will offer practical insights on best practices and new features in Forge development. Embracing modern JavaScript and React-inspired patterns in Forge will continue unlocking advanced capabilities and smoother developer experiences.

Source assisted: This briefing began from a discovered source item from Atlassian Blog. Open the original source.
How SignalDesk reports: feeds and outside sources are used for discovery. Public briefings are edited to add context, buyer relevance and attribution before they are published. Read the standards

Related briefings