Skip to main content
In Node.js (JavaScript) code steps, you can also store and retrieve data within code steps without connecting a 3rd party database. Add data stores to steps as props. By adding the store as a prop, it’s available under this. For example, you can define a data store as a dataStore prop, and reference it at this.dataStore:
export default defineComponent({
  props: {
    // Define that the "dataStore" variable in our component is a data store
    dataStore: { type: "data_store" },
  },
  async run({ steps, $ }) {
    // Now we can access the data store at "this.dataStore"
    await this.dataStore.get("email");
  },
});
props injects variables into this. See how we declared the dataStore prop in the props object, and then accessed it at this.dataStore in the run method.
All data store operations are asynchronous, so must be awaited.

Using the data store

Once you’ve defined a data store prop for your component, then you’ll be able to create a new data store or use an existing one from your account.