Control React Components' props remotely
Install the package by using
npm i react-remote-props
To use react-remote-props, Here's an example:
const [RemoteButton, setProps] = remoteProps(Button, {
size: "lg",
content: "Click Me"
});
export const App = () => {
return <RemoteButton />
}
to create a remote component inside a react component, We recommend to use useMemo
or useRef
;
export const App = () => {
const [RemoteButton, setProps] = useMemo(remoteProps(Button, {
size: "lg",
content: "Click Me"
}), []);
return <RemoteButton />
}
Creates a wrapper around a component that allows to set props remotely