Category: UI Widgets
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Unable to call storeValue() from DefaultTab property

Issue

I am trying to call the storeValue() function from the defaultTab property of a tab widget but I am getting an error saying "storeValue is not defined".

Resolution

From the error message, it seems like the function storeValue() is not defined in your current scope/context. Check to make sure that storeValue() is defined in the same file or module where you’re trying to call it from.

If storeValue() is defined in a different file or module, you’ll need to import it first using the appropriate syntax depending on the programming language you’re using. For example, in JavaScript, you can use import or require statements to bring in functions or modules from other files.

Alternatively, you could define storeValue() in the same scope/context as where you’re trying to call it from, either by defining it in the same file or module, or by passing it as a parameter to the defaultTab property. Here’s an example of passing the function as a parameter:

const storeValue = (value) => {
// your code here
}

const tabs = [
{ title: 'Tab 1', content: 'This is tab 1', defaultTab: { storeValue: storeValue } },
{ title: 'Tab 2', content: 'This is tab 2', defaultTab: { storeValue: storeValue } },
// add more tabs here
]

// create your tab widget and render it

In this example, each tab object includes a defaultTab property that includes a reference to the storeValue() function. When the user selects a tab, the tab widget will call the storeValue() function and pass in any necessary arguments. Keep in mind that this is just one example and the implementation may vary depending on your specific use case and programming language.