0.5.0 • Published 2 years ago
with-driver-licence v0.5.0
WithDriveLicence HOC
with-driver-licence is a react higher-order component (HOC) which enables a user to move with a component.
Installation
Use the npmjs package manager npmjs to install with-driver-licence.
Npm:
npm install with-driver-licence
Yarn:
yarn add with-driver-licence
Usage
// Importing withDriverLicence HOC from the package
import { withDriverLicence } from "with-driver-licence";
// Your component
const YourComponent = () => {
return (
<div
style={{
padding: "1rem",
backgroundColor: "yellow",
fontWeight: "bold",
}}
>
Your component
</div>
);
};
// Transforming your component to have driving abilities
const YourComponentWithDriverLicence = withDriverLicence(YourComponent);
// Using your transformed component in a page
export const Page = () => {
return (
<div>
<YourComponentWithDriverLicence />
</div>
);
};
You can drive a component with arrow keys: