@hocs/with-log

0.5.0 • Public • Published

🔍 with-log

npm ci coverage deps

Part of a collection of Higher-Order Components for React, especially useful with Recompose.

Injects console.log with props or any custom message into render.

Install

yarn add @hocs/with-log

Usage

withLog(
  getMessageToLog?: (props: Object) => any
): HigherOrderComponent
import React from 'react';
import { compose, withProps } from 'recompose';
import withLog from '@hocs/with-log';

const Demo = () => (
  <h1>Hi</h1>
);

export default compose(
  withProps({ a: 1, b: 2, c: 3 }),
  withLog(({ a }) => `a = ${a}`)
)(Demo);

📺 Check out live demo.

Package Sidebar

Install

npm i @hocs/with-log

Weekly Downloads

14

Version

0.5.0

License

MIT

Unpacked Size

4.36 kB

Total Files

5

Last publish

Collaborators

  • hocs