Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcolink/use-render-component
⚛️ Expose setter functions for your react component props - more of a playground than anything helpful
https://github.com/marcolink/use-render-component
Last synced: 3 days ago
JSON representation
⚛️ Expose setter functions for your react component props - more of a playground than anything helpful
- Host: GitHub
- URL: https://github.com/marcolink/use-render-component
- Owner: marcolink
- Created: 2019-12-18T08:29:26.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T10:17:04.000Z (almost 2 years ago)
- Last Synced: 2024-11-01T12:35:41.571Z (about 2 months ago)
- Language: TypeScript
- Homepage:
- Size: 736 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# use-render-component
Did you always wanted to expose a setter/getter for any of your components props?
### Example
```typescript
import * as React from "react";type ButtonProps = {
label: string,
onClick?: () => void,
};const Button: React.FC = (props) => {
return {props.label};
};const App: React.ReactNode = () => {
const button = useRenderComponent(Button, {label: "click me"});
button.updateProp("onClick", ()=> button.updateProp("label", "clicked"));
return button.component;
};```