Skip to content

Instantly share code, notes, and snippets.

View ManasJayanth's full-sized avatar

prometheansacrifice ManasJayanth

View GitHub Profile
prepareUpdate(
domElement,
type,
oldProps,
newProps,
rootContainerInstance,
hostContext
) {
const propKeys = new Set(
Object.keys(newProps).concat(
import React, { Component } from 'react';
class App extends Component {
constructor() {
super();
this.state = {
count: 0
};
}
render() {
finalizeInitialChildren(
domElement,
type,
props,
rootContainerInstance,
hostContext
) {
const { children, ...otherProps } = props;
Object.keys(otherProps).forEach(attr => {
if (attr === 'className') {
import ReactReconciler from 'react-reconciler';
const hostConfig = {
getRootHostContext(rootContainerInstance) {
return {}
},
getChildHostContext(parentHostContext, type, rootContainerInstance) {
return {};
},
@ManasJayanth
ManasJayanth / empty-host-config.js
Last active July 8, 2018 14:49
Snippets for Learn you some custom react renderers
const hostConfig = {
getRootHostContext(rootContainerInstance) {
},
getChildHostContext(parentHostContext, type, rootContainerInstance) {
},
getPublicInstance(instance) {
},
@ManasJayanth
ManasJayanth / renderer-with-only-render-function.js
Created June 22, 2018 04:07
Snippets for Learn you some custom react renderers
import ReactReconciler from 'react-reconciler';
const hostConfig = {};
const DOMRenderer = ReactReconciler(hostConfig);
let internalContainerStructure;
export default {
render(elements, containerNode, callback) {
// We must do this only once
@ManasJayanth
ManasJayanth / index-that-requires-custom-renderer.js
Created June 22, 2018 03:28
Snippets for Learn you some custom react renderers
import React from 'react';
import ReactDOM from './renderer.js';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
@ManasJayanth
ManasJayanth / my-react-dom-empty.js
Last active June 22, 2018 03:58
Snippets for Learn you some custom react renderers
export default {}
@ManasJayanth
ManasJayanth / App.js
Created June 22, 2018 03:21
Snippets for Learn you some custom react renderers
import React, { Component } from 'react';
class App extends Component {
constructor() {
super();
this.state = {
count: 0
};
}
render() {
@ManasJayanth
ManasJayanth / react-dom-replacement.js
Last active July 12, 2018 14:39
Illustrative light weight react-dom library
import css from 'dom-helpers/style';
import Reconciler from 'react-reconciler';
const isEventRegex = /^on([A-Z][a-zA-Z]+)$/;
const RDL = Reconciler({
getRootHostContext() {
return '';
},
getChildHostContext() {