Created
November 18, 2016 05:29
-
-
Save brendanmckenzie/d73697cf80fb25ef627f66a0ce94d703 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ReactDOM from 'react-dom' | |
import React from 'react' | |
import Templates from '../../../templates' | |
fetch('./data.json') | |
.then(res => res.json()) | |
.then(res => { | |
const template = res.$template | |
if (template && template in Templates) { | |
var el = React.createElement(Templates[template], res) | |
ReactDOM.render(el, document) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment