
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
bippya hacky way to get fibers from react. used internally for react-scan.
bippy works by setting a "fake" version of the __REACT_DEVTOOLS_GLOBAL_HOOK__ object. this gives us access to react internals without actually using react devtools.
[!WARNING] this project uses react internals, which can change at any time. this is not recommended for usage and may break production apps - unless you acknowledge this risk and know exactly you're doing.
here i wrote a getRenderInfo function, where you're able to pass any component identifier and get back the number of times it rendered, as well as the total and self time. this is done by traversing the fiber tree during a commit via onCommitFiberRoot.
inspect it live here.
import {
instrument,
createFiberVisitor,
getTimings,
getDisplayName,
} from 'bippy'; // must be imported BEFORE react
import React, { useState } from 'react';
import ReactDOM from 'react-dom/client';
const componentRenderMap = new WeakMap();
const visitor = createFiberVisitor({
onRender(fiber, phase) {
const componentType = fiber.elementType;
if (
typeof componentType !== 'function' &&
(typeof componentType !== 'object' || !componentType)
) {
return;
}
const render = componentRenderMap.get(componentType) || {
count: 0,
selfTime: 0,
totalTime: 0,
displayName: getDisplayName(componentType),
};
render.count++;
const { selfTime, totalTime } = getTimings(fiber);
render.selfTime += selfTime;
render.totalTime += totalTime;
componentRenderMap.set(componentType, render);
console.log(phase, render);
},
});
instrument({
onCommitFiberRoot: (rendererID, fiberRoot) => {
visitor(rendererID, fiberRoot);
},
});
export const getRenderInfo = (componentType) => {
return componentRenderMap.get(componentType);
};
function App() {
const [count, setCount] = useState(0);
const renderInfo = getRenderInfo(App);
return (
<button onClick={() => setCount(count + 1)}>
rendered: {JSON.stringify(renderInfo, null, 2)}
</button>
);
}
ReactDOM.createRoot(document.getElementById('root')).render(<App />);
the original bippy character is owned and created by @dairyfreerice. this project is not related to the bippy brand, i just think the character is cute
FAQs
hack into react internals
The npm package bippy receives a total of 424,082 weekly downloads. As such, bippy popularity was classified as popular.
We found that bippy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.