function Box({ handleClick, handleHover }: { handleClick: () => void; handleHover: () => void }) {
...
}
const NewBox = withRenames({
onClick: "handleClick",
onMouseOver: "handleHover"
// ↑ oldProps goes to right
// ↑ newProps goes to left
})(Box);
<NewBox onClick={() => {}} onMouseOver={() => {}} />
// is equivalent to
<Box handleClick={() => {}} handleHover={() => {}} />
function Box({ handleClick, handleHover }: { handleClick: () => void; handleHover: () => void }) {
...
}
const NewBox = withRenames({
onClick: "handleClick",
onMouseOver: "handleHover"
// ↑ oldProps goes to right
// ↑ newProps goes to left
})(Box);
<NewBox onClick={() => {}} onMouseOver={() => {}} />
// is equivalent to
<Box handleClick={() => {}} handleHover={() => {}} />
Generated using TypeDoc
Make your component receive new props by renaming them.