npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jhoguet/react-debugger

v0.0.2

Published

a simple debugger that enables you to access the react components given a dom node

Downloads

4

Readme

react-debugger

:exclamation: Use with caution, this is still in the proof of concept phase and lacks adequate testing both in automated tests and in the wild.

Getting Started

npm install @jhoguet/react-debugger

Then in your webpack config, load this file first...

entry: [
    '@jhoguet/react-debugger',
    './src/index.js'
],

Intent

The intent of this debugger is to provide runtime support for getting access to the react components given a dom node. It is inspired by Angular 1.x's angular.element($0).scope().

Api

window.$r(domNode) will get you an instance of ReactElementDebugger which wraps a ReactElement.

ReactElementDebugger

.parents() will list the DisplayName of each parent that has one

.parent(displayName) will walk to the parent with that DisplayName

.parent() will walk to the parent react element

.instance() will get the react element instance for the current ReactElement, this is useful if you have any state of functions living directly on this of your ReactElement

.props() will get you the props for your ReactElement, depending on the ReactElement this may not be very useful so it is best used after calling .parent(someDisplayName) to get to a ReactElement that has relevant props sent to it.

.displayName will get you the displayName of the current ReactElement

._raw gets you the raw ReactElement and isn't intended to be used.

Assumptions / Constraints

  • The debugger should defer as much as possible to "debug time" so that "startup" and "run time" are minimally impacted.
  • This only works with React 0.15+, the way this works in < 0.15 is much more complex and wasn't worth porting in.
  • I have only explored a couple of ways of walking the react tree, I am sure there are others to consider. see getParent() if it is missing a parent you expected it to walk through.

Similar Projects

Next Steps / How to help

  • better build system so we can have separate files
  • automated tests in a browser (real dom)
  • improve the documentation (api)
  • make it possible for the consumer to specify the global they want (if any) instead of assuming $r