first off all you need to create a file remote-component.config.js
inside your src/
folder
/*eslint-disable*/
module.exports = {
resolve: {
react: require("react"),
},
};
next create a file RemoteComponent.js
inside your src/
folder
/*eslint-disable*/
import { createRemoteComponent, createRequires } from "rex-the-reporter-dog";
import { resolve } from "./remote-component.config";
const requires = createRequires(resolve);
export const RemoteComponent = createRemoteComponent({ requires });
Now you can use Rex for going to search your components and give it to you !
The proccess is simple:
- import the RemoteComponent created before
import { RemoteComponent } from "../../RemoteComponent";
- then add it to you jsx return:
<RemoteComponent url={uri_of_your_bundle.js} />
And "Voilà" !