A module that allows use React DevTools for inspection your component hierarchy without React.
See DEMO
npm i --save-dev react-devtools-symbiote
import {connect} from 'react-devtools-symbiote';
const symbiote = connect({
getInitialRoots() {
return [{
// VNode
type: AppClass,
dom: document.getElementById('app'),
props: {name: 'MyApp'},
children: [{
type: 'div',
props: {
className: 'text',
},
children: [{
type: '#', // text node
children: 'Wow!1',
}],
}],
}];
},
});
// Update
symbiote.update(vnode);
// Unmount/destroy
symbiote.unmount(vnode);
interface VNode {
key?: string;
ref?: string;
dom: HTMLElement | Text;
type: Function | string;
props: Object;
children?: string | VNode[];
setProps?: (newProps: object) => void;
setState?: (newState: object) => void;
forceUpdate: () => void;
_source: Source;
}
interface Source {
fileName: string;
lineNumber: number;
}
npm i
npm test
, code coverage