Sha256: ab631ddc8eebe7651c46a1cae751a69a95810d0c41988491a454f74726102b79

Contents?: true

Size: 644 Bytes

Versions: 88

Compression:

Stored size: 644 Bytes

Contents

// 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 PropTypes from 'prop-types'

const Hello = props => (
  <div>Hello {props.name}!</div>
)

Hello.defaultProps = {
  name: 'David'
}

Hello.propTypes = {
  name: PropTypes.string
}

document.addEventListener('DOMContentLoaded', () => {
  ReactDOM.render(
    <Hello name="React" />,
    document.body.appendChild(document.createElement('div')),
  )
})

Version data entries

88 entries across 88 versions & 12 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/webpacker-5.4.4/lib/install/examples/react/hello_react.jsx
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/webpacker-5.4.4/lib/install/examples/react/hello_react.jsx
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/webpacker-5.4.4/lib/install/examples/react/hello_react.jsx
jetpacker-0.7.0 lib/install/examples/react/hello_react.jsx
webpacker-5.4.4 lib/install/examples/react/hello_react.jsx
jetpacker-0.6.0 lib/install/examples/react/hello_react.jsx
webpacker-5.4.3 lib/install/examples/react/hello_react.jsx
webpacker-5.4.2 lib/install/examples/react/hello_react.jsx
webpacker-5.4.1 lib/install/examples/react/hello_react.jsx
webpacker-5.4.0 lib/install/examples/react/hello_react.jsx
webpacker-5.3.0 lib/install/examples/react/hello_react.jsx
webpacker-5.2.2 lib/install/examples/react/hello_react.jsx
interactive_record-0.0.1alpha app/javascript/packs/hello_react.jsx
fiver-0.0alpha app/javascript/packs/hello_react.jsx
jetpacker-0.5.0 lib/install/examples/react/hello_react.jsx
webpacker-5.2.1 lib/install/examples/react/hello_react.jsx
webpacker-4.3.0 lib/install/examples/react/hello_react.jsx
webpacker-5.2.0 lib/install/examples/react/hello_react.jsx
webpacker-5.1.1 lib/install/examples/react/hello_react.jsx
webpacker-5.1.0 lib/install/examples/react/hello_react.jsx