Skip to content

Instantly share code, notes, and snippets.

@hpjaj
Created November 14, 2018 03:09
Show Gist options
  • Select an option

  • Save hpjaj/63d65a0b50fc1900b9d482e8be2fe79c to your computer and use it in GitHub Desktop.

Select an option

Save hpjaj/63d65a0b50fc1900b9d482e8be2fe79c to your computer and use it in GitHub Desktop.
// app/javascript/packs/index.js
// Run this example by adding <%= javascript_pack_tag 'hello_react' %> to the head of your layout file,
// like app/views/layouts/application.html.erb. All it does is render <div>Hello React</div> at the bottom
// of the page.
import React from 'react'
import ReactDOM from 'react-dom'
import App from '../components/App'
document.addEventListener('DOMContentLoaded', () => {
ReactDOM.render(
<App />,
document.body.appendChild(document.createElement('div')),
)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment