Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-hoc-console

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hoc-console

A way to see logs into React app through a simple and helpful UI.

  • 0.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

React HOC Console

This is a simple HOC that allows you to see what is happening with the native console API, however, into your app. It's personalizable, I mean, you can activate or deactivate this HOC.

How to use

The reactConsole method provides two parameters, the first one is waiting for a React component. The second one is a boolean that activates or deactivate the console UI. You still be able to see the native console working through the dev tools.

/**
 * @param {React.Component} component - React component
 * @param {Boolean} activate - Should console UI is activated
 * @param {Boolean} autoScroll - Console UI scrolls down automatically when it receives new logs
 */
reactConsole(component:React.Component, activate:boolean = true, autoScroll:boolean = true);

HOC working:

Below is a code generated by npx create-react-app and modified to show the effect of the console. Read more.

import React, { Component } from 'react';
import reactConsole from 'react-hoc-console';
import logo from './logo.svg';
import './App.css';

class App extends Component {
  componentDidMount() {
    console.log('Component Did Mount!');
    console.info('Component Did Mount!');
    console.warn('Component Did Mount!');
    console.debug('Component Did Mount!');
    console.error('Component Did Mount!', 'App.js - 12');
  }
  render() {
    return (
      <div className="App">
        <header className="App-header">
          <img src={logo} className="App-logo" alt="logo" />
          <p>
            Edit <code>src/App.js</code> and save to reload.
          </p>
          <a
            className="App-link"
            href="https://reactjs.org"
            target="_blank"
            rel="noopener noreferrer"
          >
            Learn React
          </a>
        </header>
      </div>
    );
  }
}

export default reactConsole(App);
screenshot 2019-01-26 at 05 51 30

Keywords

FAQs

Package last updated on 26 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc