react-console-log-plus-hook

A custom hook for React which allows to use console-log-plus easily in functional components


Keywords
react, console-log-plus, react-hook
License
MIT
Install
npm install react-console-log-plus-hook@0.0.2

Documentation

react-console-log-plus-hook

[![NPM version][npm-image]][npm-url] [![Dependency Status][daviddm-image]][daviddm-url]

A custom hook for React which allows to use console-log-plus easily in functional components.

How to install

# using npm
> npm install react-console-log-plus-hook --save

# using yarn
> yarn add react-console-log-plus-hook

How to use

import React from "react";
import ReactDOM from "react-dom";

import { useLogger } from "react-console-log-plus-hook";

function App() {
  const logger = useLogger();

  return (
    <button
      onClick={() => logger.clp({ type: "info", message: "You clicked me!" })}
    >
      Click Me!
    </button>
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);