top of page

Go-To-Market Tools & Solutions

PARNii.DE

Websites & Mobile Apps featuring unique design and varying levels of functionality for micro, small, and medium-sized businesses, created by an official Wix Legend Partner.

How to build a custom data source in Wix Studio Two

Nov 2
4 min read

Updated: Nov 4

To build a custom Data Source in Studio Two, generate one from the Wix Extension Builder in the Code tab, then edit its two files: a context provider manifest and a React provider component. After that, attach it to a page, container or section and connect element properties to its exposed items.


Before you start

  • Access to the Studio Two editor and its Code tab, which includes the Wix Extension Builder.

  • Basic knowledge of React, React Context and TypeScript.

  • An idea of the state and functions that several components need to share, such as a selected department and a filter function.


Step by step

  1. Generate the Data Source. In the Studio Two editor, open the Code tab and then the Wix Extension Builder in the VS Code sidebar. Under Create an Extension, choose Site > Data Source, enter a Name and click Generate.

  2. Understand the generated files. The Extension Builder derives the folder name and manifest type from your name, so Team Filter becomes team-filter and companionApp.teamFilter. The files are in src/extensions/site/contexts/<provider-folder>/. The extension is registered in extensions.ts and listed under My Extensions.

  3. Declare the contract in the manifest. Open <provider-folder>.extension.ts. It uses extensions.contextProvider(). Describe each value and function ERCs can connect to in context.items, add configuration inputs to data, and use resources to point at the provider component and its context hook. Update displayName, context.items and data for your use case.

  4. Keep the generated id stable. Once Wix users have connected elements to the Data Source, do not change its id. Changing it risks breaking those connections.

  5. Implement the provider component. Open <provider-folder>.tsx. Implement every item declared in context.items and accept each data input you use as a prop. Export the hook named in resources.contextSpecifier.hook and export the provider component as the default export.

  6. Refine state and scope. Keep each Data Source focused on one domain, and expose values together with the functions that change them. Derive values from other state with useMemo instead of storing them twice. Separate frequently changing values from stable ones, because every connected ERC that gets an updated value renders again. If you load data from a configuration input, expose loading and error state when ERCs need to show them.

  7. Cross-check manifest and code. Confirm that each context.items entry has a matching value or function in the provider. Check that each input has a data entry and a prop, and that function parameters and responses match in manifest and TypeScript. Make sure resources.client.url and contextSpecifier.hook match the provider file and its export.

  8. Attach the Data Source. Switch to the Design tab and select the page, container or section in the Layers panel. Choose More Actions > Connect to Data, click Connect Source and select your Data Source under Custom code. Attach it at the narrowest scope that needs it.

  9. Set configuration inputs. If the manifest declares data inputs, click the Manage button in the floating toolbar or the row of the connected source. Each input shows its displayName, so initialCount appears as Initial Count.

  10. Connect element properties. Select an element inside the area you attached the source to and open its Settings panel. Click the connect icon next to a property. In the Connect to Data panel, choose your Data Source under Source and an item under Field, then click Apply.

  11. Publish. When the connected elements show the expected values, click Publish in the Studio Two editor. The Data Source ships with the published site.


Good to know

  • The editor and Extension Builder call this extension a Data Source, but the generated code uses context provider APIs and React Context.

  • The generated Data Source is a counter. Changing current + 1 to current + 2 in the increment function is a quick way to test your edit cycle.

  • ERCs connect to exposed items through editor binding. They do not call the context hook directly.

  • The Field list shows only items whose data type matches the selected property. It picks the item automatically when only one matches.

  • A Data Source attached to a container affects only the components nested in it. One attached to a page can affect every connected component on that page.


parnii note

Plan the contract in context.items before writing the provider, and avoid renaming the id once elements are connected. Test the Data Source on a copy of the site first, on a small container, before attaching it at page level.

FAQ

What files make up a custom Data Source in Studio Two?

A custom Data Source has two files. One is a context provider manifest (<provider-folder>.extension.ts). The other is a React provider component (<provider-folder>.tsx).

Why does my ERC not receive a value from the Data Source?

Check three things. The Data Source must be attached above the ERC, the ERC prop must be connected to the right context item, and both manifests must use compatible data types.

Where do I attach a custom Data Source?

Attach it to a page, container or section. Choose the narrowest scope that needs it, because a container source affects only nested components, while a page source can affect the whole page.

Sources


Part of our Wix Studio Two series (Studio 2). Last checked: 02 November 2026.

Tips and tricks every two weeks

Featured Go-To-Market (GTM) Tools and Solutions

bottom of page