Scripts
Use Scripts to manage common logic and and simple data handling for your app
React Providers
By default, the script is executed with these additional parameters in the function to access the context of the application and modify the app behavior.
Global Dispatch
Allow to modify the global context of the application
Dispatch Session Context
Allows you to modify values related to the logged-in user
Dispatch Overlay
Allows you to modify values related to the overlay context
Dispatch Form
Works if the script is being executed inside a Form element, otherwise it will be undefined. Allows you to modify form values eg:
Local Context
You will also have access from this parameter to the localContext of parent elements that are executing the script.
The localContext will have the same name as the name configured in the Figma component with two attributes: state and dispatch.
State
Object
State will have the state of the localContext
dispatch
Object
dispatch will allow to modify the state of the localContext in question
Code Example
Code example using the dispatch object to show an alert in the app window
Last updated
Was this helpful?