2) Update an item's properties with `sync()`
In the second task of the guided onboarding, you modify and then update board items with the sync()
method.
Time to complete
~5 minutes
Learning objective
After completing this onboarding task, you'll be able to:
- Initiate and manage updates to board items using the
sync()
method.
Let’s update the properties of a board item and see the changes take place.
Action: update your sticky note
Review the snippet in the code editor below and run it. The code below will:
- Update your sticky note's color to light blue.
- Change your sticky note's position to x = 100, y = 100.
ℹ️ Note: Updates require two steps:
- Change the property value.
- Call
sync()
on the item to make the changes effective.
const stickyNote = await miro.board.createStickyNote({
content: 'Hello'
});
// First, you change the values of the properties you want to update.
stickyNote.content = 'Updated sticky note';
stickyNote.style.fillColor = 'light_blue';
stickyNote.x = 100;
stickyNote.y = 100;
// Second, you sync the item to make the changes effective.
await stickyNote.sync();
Let's wrap up
In this onboarding task, you:
- Updated the properties of an existing item on a Miro board, using the
sync()
method.
Now that you've updated your sticky note, let's run an app inside a Miro board!
See also
Updated about 1 year ago
What's next
In the third task of the guided onboarding, you create and run an app on a board.