DEV Community

itwillwork
itwillwork

Posted on

3 1

Understand React render better

To answer the question. Why did the rendering happen?

example

Advantages

  • used directly for one component, therefore it works very fast

  • for all versions of React from 0.13.0 to 16.0.0

  • zero dependencies

Install

npm install clear-render --save-dev

You can set globally, to be used in all their projects without having to install each.

Usage

Wrap the component for which you want to watch. And yet!

import clearRender from 'clear-render';

@clearRender
class SimpleComponent extends React.Component {

    ...

}

or

import clearRender from 'clear-render';
import OriginalSimpleComponent from './SimpleComponent';

const SimpleComponent = clearRender(OriginalSimpleComponent);

...

<SimpleComponent {...props} />

Usage for CodePen and JSBin as UMD module

in html area

<script src="https://unpkg.com/clear-render@latest/build/umd/index.js"></script>

in js area use clearRender from global scope

@clearRender
class SimpleComponent extends React.Component {

    ...

}

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay