Skip to content

Latest commit

 

History

History
46 lines (28 loc) · 1.73 KB

README.md

File metadata and controls

46 lines (28 loc) · 1.73 KB

DFOhub app

This package contains the main application, based on Create React App.

Prerequisites

A good knowledge of React and React hooks is required.

The app structure

The App component has two ContextProvider, both imported from the core package:

  • Web3ContextProvider allows connecting to Ethereum and listening on any change
  • PluginsContextProvider allows using the plugin system

The MainTemplate component is the template of every page of the app. It shows a header, a menu and the supllied component.

The Menu component loads the menu from the plugin system, with a usePlaceholder hook.

The routing is performed inside the router.js file. It uses the same usePlaceholder hook to retrieve the routes. If the supplied route requires a connection to Ethereum and the connection is not yet established, it will show the Connect component, otherwise the route component will be rendered.

It's recommended to keep using the plugin system for the menu and the routing and not write these items directly in the app package.
The PluginsContextProvider in the App component loads the plugins from the sample-plugin package, which can be considered as a reference implementation.

The src/data/context.json file keeps the configuration to initialize web3.

Build

The app uses the default Create React App scripts.

To build the app, you can use the lerna scripts in the root project (build and build-dev), as stated in the root project documentation.

If you prefer to build only this package, just run:

npm run build

Run

To run the app, execute:

npm run start