Skip to main content

Components

Discovery allows you to create a decentralized frontend by writing and composing small applications known as Components.

Components are stored in the NEAR blockchain, and execute locally in a custom Virtual Machine, thus ensuring the component can not access local storage or cookies.

Discovery API

Components use the Discovery API to process data, fetch data from other websites, and interact with blockchains.


Creating a Component

To create a component you simply need to implement a return statement, returning some HTML code.

Loading...

Props: Receiving Input

Components can take arbitrary input, which will be reflected in the props variable. In the example below, we are passing as input name="Anna".

Loading...

State: Storing Information

Components have an internal state were they can store information.

Loading...

Composing Components

To compose components you will use the Predefined Widget component. For this, you will only need the NEAR username of who created the component, and the component's name.

Loading...