Coder Social home page Coder Social logo

ptzagk / lchoc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vb/perf-hoc

0.0 0.0 0.0 39 KB

Visualize and detect unnecessary rendering and performance issues in React.

Home Page: https://build-ehksycopda.now.sh/

CSS 11.42% JavaScript 88.58%

lchoc's Introduction

lcHOC - Lifecycle HOC

lcHOC is a HOC (higher order component) in React that visualize rendering and logs helpful information.

Enhance each component you want to study with lcHOC and every time that component updates, a green flash wraps the component (much like paint flashing in devtools) and debugging information is logged to the console.

Installation and usage

// Step 1: Install
npm install lc-hoc --save-dev;

// Step 2: Import
import lcHOC from 'lc-hoc';

// Step 3: Enhance
// by decorating
@lcHOC
class componentToStudy extends Component { ...

// or by wrapping
export default lcHOC(componentToStudy);

Customize

{
  log: {
    use: true,
    expanded: false,
    renderCount: true,
    state: true,
    props: true,
    timings: true
  },
  flash: true
}

You can customize lcHOC by overriding the default settings object above. Example below.

// Decorating with customization
@lcHOC({flash: false, log: {state: false}})

// Wrapping with customization
lcHOC(componentToStudy, {
  flash: false,
  log {
    state: false
  }
});

Contribute

If you have ideas on how to improve this component feel free to request a feature or submit a pull request!

lchoc's People

Contributors

vb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.