function Box({ handleClick }: { handleClick: () => void }) {
...
}
const NewBox = withRename("onClick", "handleClick")(Box);
// ↑ this will be the property
<NewBox onClick={() => {}} />
// ↑ onClick is the new prop
// is equivalent to
<Box handleClick={() => {}} />
function Box({ handleClick }: { handleClick: () => void }) {
...
}
const NewBox = withRename("onClick", "handleClick")(Box);
// ↑ this is the old prop
<NewBox onClick={() => {}} />
// is equivalent to
<Box handleClick={() => {}} />
// ↑ this is the old prop
function Box({ handleClick }: { handleClick: () => void }) {
...
}
const NewBox = withRename("onClick", "handleClick")(Box);
<NewBox onClick={() => {}} />
// is equivalent to
<Box handleClick={() => {}} />
Generated using TypeDoc
Make your component receive a new prop by renaming it.