Regions
A region is a named place in the app’s shell, where the views bound to that name appear.
Region names
A region name is a plain string. You don’t register it anywhere.
A module names the region in withView(storeId, Component, region), and the shell shows that region with <RegionView regionName="..." />.
If no RegionView uses a region name, the views bound to it don’t appear.
The shell
The shell is a React component that places the regions.
This is a shorter version of the shell of the example app. The todo module binds its view to main, and the weather module to weather:
import { RegionView } from 'esp-js-react';
export const AppShell = () => (
<div style={{ display: 'flex', gap: '24px' }}>
<div style={{ flex: 1 }}>
<RegionView regionName="main" />
</div>
<div style={{ width: '360px' }}>
<RegionView regionName="weather" />
</div>
</div>
);
Render the shell inside EspApp: see EspApp.
For what RegionView renders, see RegionView.
View order
When more than one view is bound to a region, RegionView shows them in this order:
- By module, in the order the app adds the modules with
withModule. - Within a module, in the order of its
withViewcalls.