1.0.1 • Published 6 years ago

react-render-counter v1.0.1

Weekly downloads
57
License
MIT
Repository
github
Last release
6 years ago

Example Component: react-render-counter

RenderCounter is a tool component can be used in dev environment. It can tell you how many times each part of your component has been rendered.
This is composed with a HOC and a pure component to count render times
HOC is also useful when you want to track render times for your component.

Installation

yarn add --dev react-render-counter

or

npm install --save-dev react-render-counter

Usage

  1. RenderCounter - withRenderCount(Counter)
import RenderCounter from 'react-render-counter';

<AnyComponent>
  <RenderCounter initialCount={0} />
</AnyComponent>
  1. withRenderCount - High order component to provide data and logic
import { withRenderCount } from 'react-render-counter';

const MyCounter = ({ count }) => <div>{count + 1}</div>;

export default withRenderCount(MyCounter);
  1. Counter - Pure component to render count
import { Counter } from 'react-render-counter';

<div>
  <Counter count={1} /> 
</div>
  1. hocs - Some handy higher-order components.
// MyComponent.js
import withFoo from 'react-render-counter/hocs/withFoo';

const MyComponent = () => <div />;

export default withFoo(MyComponent);
// MyHoc.js
import compose from 'recompose/compose';
import withFoo from 'react-render-counter/hocs/withFoo';
import withBar from 'react-render-counter/hocs/withBar';

export default (fooOptions, barOptions) => compose(
  withFoo(fooOptions),
  withBar(barOptions),
);

Documentation

With storybook, things below are included in the site:

  • online demo
  • prop tables
  • code examples
  • TODO: comments

License

Copyright © 2017, Stupidism. Released under the MIT license.

1.0.1

6 years ago

1.0.0

6 years ago

0.8.1

7 years ago

0.8.0

7 years ago

0.7.1

7 years ago

0.7.0

7 years ago

0.6.2

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago

0.5.0

7 years ago

0.4.2

7 years ago

0.3.0

7 years ago

0.2.6

7 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.3

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago