0.0.5 • Published 1 year ago

react-remote-props v0.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

react-remote-props

Control React Components' props remotely

npm NPM

Installation

Install the package by using

npm i react-remote-props

Usage

To use react-remote-props, Here's an example:

const [RemoteButton, setProps] = remoteProps(Button, {
    size: "lg",
    content: "Click Me"
});

export const App = () => {
    return <RemoteButton />
}

Inside React Component

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 />
}

API References

remoteProps<T>(component: ComponentType<T>, initialProps: Partial<T>)

Creates a wrapper around a component that allows to set props remotely

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.1

1 year ago

0.0.0

1 year ago