# All files / src/chap05 ProfilerBasic.js

0% Statements 0/8
100% Branches 0/0
0% Functions 0/2
0% Lines 0/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23

     import { Profiler } from 'react';
    import HeavyUI from './HeavyUI';

    export default function ProfilerBasic() {
      // 성능 측정을 위한 함수(onRender 함수)
      const handleMeasure = (id, phase, actualDuration,
        baseDuration, startTime, endTime) => {
        console.log('id: ', id);
        console.log('phase: ', phase);
        console.log('actualDuration: ', actualDuration);
        console.log('baseDuration: ', baseDuration);
        console.log('startTime: ', startTime);
        console.log('endTime', endTime);
      };

      return (
      <Profiler id="heavy" onRender={handleMeasure}>
        <HeavyUI delay={1500} />
        <HeavyUI delay={500} />
        <HeavyUI delay={2000} />
      </Profiler>
      );
    }