Webpacker: Hello World

Created on 2 May 2017  路  3Comments  路  Source: rails/webpacker

It's proving surprisingly difficult to following the installation guide for Webpacker and ultimately get that line from application.js to log:

console.log('Hello World from Webpacker')

Or, to see hello_react.jsx on the screen.

Could you guys add a reference to an example app that accomplishes this simple goal?

style loaders

Most helpful comment

Awesome! Add to official README?

My biggest hang-up was trying to figure out how to pass props from a controller or a .html view to a React component. javascript_pack_tag doesn't seem to do the job. I finally settled on the webpacker-react gem as the only way to do it.

Is there an official blessed path for that?

All 3 comments

There's a great article by @gauravtiwari.
You can also checkout my Github repo, this is probably the fastest way to get started.

Awesome! Add to official README?

My biggest hang-up was trying to figure out how to pass props from a controller or a .html view to a React component. javascript_pack_tag doesn't seem to do the job. I finally settled on the webpacker-react gem as the only way to do it.

Is there an official blessed path for that?

@mandysimon88 This part is dependent on community integrations. We will document this in README. Both webpacker-react and react-rails provides first class support for webpacker - https://github.com/reactjs/react-rails#use-with-webpacker (react-rails is on more mature side with support for server side rendering etc.)

Was this page helpful?
0 / 5 - 0 ratings