0.0.7 • Published 2 years ago
common-master-micro-fe-integration v0.0.7
use-web-component
1.Reason
hook to integrate web component in minutes
we have these web-components:
- project-master
- department-master
2.React tutorial
- install
yarn add use-web-component-mfv
- define remote main.js,
- tag name: important !, tag name must be right
- bridge: data that need to transfer from host app to remote app
- input types and hook can get from this npm
import { ProjectMaster, useWebComponent } from 'common-master-micro-fe-integration'
const bridge = {
axios, fetch, routerFn, permissions, ...
}
export default function Page() {
const [WebComponent] = useWebComponent<ProjectMaster>('http://localhost:3002/main.js', 'project-master', bridge)
return <WebComponent title="1" name="2" />
}