I'm trying to setup my new project with Rails 5.1 and Wepacker-react, but I get first error very quickly. I have been created new component in javascript/packs The code is basic:
javascript/packs/home.jsx
import React from 'react'
import ReactDOM from 'react-dom'
import PropTypes from 'prop-types'
const Home = props => (
<div>Hello {props.name}!</div>
)
Home.defaultProps = {
name: ''
}
Home.propTypes = {
name: PropTypes.string
}
document.addEventListener('DOMContentLoaded', () => {
ReactDOM.render(
<Home name="Daniel" />,
document.body.appendChild(document.createElement('div')),
)
})
Im rendering this component in index view:
index.html.erb
<%= javascript_pack_tag 'home' %>
But I got this error: MissingEntryError
I would to add that I had imported this component in app....js What is missing?