Skip to content
Developerhome

Reset State (resetState)

  Less than to read

In JSON schema, the “resetState” property is a powerful tool that allows you to reset or clear the state of components or variables within your application. It enables you to revert data back to its initial values or empty states, providing a way to start fresh or undo any changes made by the user. This guide will explain the purpose and usage of the “resetState” property in JSON schema.

"onClear": [
  {
    "resetState": {}
  }
]

Understanding resetState

The “resetState” property is typically used within the “actions” section of the JSON schema to define actions that reset the state of specific components or variables. It can be triggered by events, user interactions, or specific conditions within your application.

When the action containing “resetState” is executed, it resets the targeted components or variables to their initial values or default states. This ensures consistency and allows you to manage the state of your application effectively.

Using “resetState” in the JSON schema provides you with a powerful mechanism to reset the state within your application. By defining the “resetState” action and triggering it based on specific events or conditions, you can effectively manage and control the state of your application. This functionality allows for better user experience, enabling users to revert changes, clear input fields, or restore default settings when needed. Understanding “resetState” empowers you to build applications that are more flexible, user-friendly, and responsive to user interactions.