Skip to content

Instantly share code, notes, and snippets.

@brendanmckenzie
Created November 18, 2016 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brendanmckenzie/d73697cf80fb25ef627f66a0ce94d703 to your computer and use it in GitHub Desktop.
Save brendanmckenzie/d73697cf80fb25ef627f66a0ce94d703 to your computer and use it in GitHub Desktop.
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