react-stable-ref
Version:
An assortment of utilities for testing against unstable references in React
26 lines • 1.11 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var useRenderCount_1 = __importDefault(require("./useRenderCount"));
var RenderCount = function (_a) {
var _b = _a.initialCount, initialCount = _b === void 0 ? 1 : _b, count = _a.count;
var currentCount = useRenderCount_1.default(count || initialCount);
return (react_1.default.createElement("span", { style: {
display: 'inline-block',
boxSizing: 'border-box',
minWidth: '30px',
background: 'white',
borderRadius: '15px',
padding: '2px 6px',
textAlign: 'center',
fontSize: '12px',
color: '#bf2600',
backgroundColor: '#ffebe6',
fontFamily: '-apple-system, BlinkMacSystemFont, sans-serif',
} }, count ? count : currentCount));
};
exports.default = RenderCount;
//# sourceMappingURL=RenderCount.js.map