)
```
--------------------------------
### Connecting React Component with connectWithShell
Source: https://github.com/wix-incubator/repluggable/blob/master/README.md
Example of using `connectWithShell` to create a connected container for a React component. This function allows the component to access APIs from the shell. It demonstrates how `mapStateToProps` and `mapDispatchToProps` receive the `shell` object as the first argument.
```TypeScript
export const createFoo = (boundShell: Shell) => connectWithShell(
// mapStateToProps
// - shell: represents the associated entry point
// - the rest are regular parameters of mapStateToProps
(shell, state) => {
return {
// some properties can map from your own state
xyzzy: state.baz.xyzzy,
// some properties may come from other packages' APIs
bar: shell.getAPI(BarAPI).getCurrentBar()
}
},
// mapDispatchToProps
// - shell: represents the associated entry point
// - the rest are regular parameters of mapDispatchToProps
(shell, dispatch) => {
return {
// some actions may alter your own state
setXyzzy(newValue: string): void {
dispatch(FooActionCreators.setXyzzy(newValue))
},
// others may request actions from other packages' APIs
createNewBar() {
shell.getAPI(BarAPI).createNewBar()
}
}
},
boundShell
)(FooSfc)
```
--------------------------------
### AppHost Initialization and Rendering
Source: https://github.com/wix-incubator/repluggable/blob/master/README.md
Demonstrates the minimal responsibilities of the main application: initializing an AppHost with pluggable packages and rendering the AppMainView component.
```javascript
import React from 'react';
import AppHost from './AppHost'; // Assuming AppHost is defined elsewhere
import AppMainView from './AppMainView'; // Assuming AppMainView is defined elsewhere
const pluggablePackages = [
// List of pluggable packages
];
function App() {
const appHost = new AppHost(pluggablePackages);
return (