0

I’m facing a challenge with my project’s API integration.

Here’s the use case: I need to fetch data from an API, and once I receive a successful response, I want to enable a copy button/icon to copy that content. However, during page load and while waiting for the API response, I need to hide the copy button. How can I achieve this functionality effectively?

Any suggestions or code examples would be greatly appreciated.

I've tried to manage with custom state but it's not working.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

0
  1. On the Layout tab for the button, disable "This element is visible on page load." That will hide it by default.
  2. On the Conditional tab, create a condition and select "Get data from an external API" for the Why.
  3. Choose your API provider from the pop up.
  4. Complete the condition by pulling any field from the API and choosing "is not empty".
  5. Click "Select a property to change when true" and choose "This element is visible". Make sure the box is ticked to show the element.

That's it!

Here's a screenshot example