0.5.0 • Published 2 years ago

with-driver-licence v0.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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:

Demo

License

MIT

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago