Skip to content

Commit

Permalink
Update react.md (#514)
Browse files Browse the repository at this point in the history
I had to modify `app/javascript/packs/application.js` to get this to work for me. I'm not sure if this was a recent update to the structure of shakapacker. I thought the documentation should be updated to help future readers.
  • Loading branch information
rianrainey authored Sep 12, 2024
1 parent 13a60e0 commit 6e769d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/react.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Update the Babel configuration in the `package.json` file:
},
```

And that's it. You can now create a React app using `app/javascript/application.js` as your entry point.
And that's it. You can now create a React app using `app/javascript/packs/application.js` as your entry point.

## Enabling Hot Module Replacement (HMR)

Expand Down Expand Up @@ -152,7 +152,7 @@ echo '<div id="root"></div>' > app/views/site/index.html.erb
touch app/javascript/App.css app/javascript/App.js
```

4. Edit `app/javascript/application.js` like so:
4. Edit `app/javascript/packs/application.js` like so:
```jsx
import React from 'react';
import { createRoot } from 'react-dom/client';
Expand Down Expand Up @@ -267,4 +267,4 @@ rails s

11. Edit either the React component at `app/javascript/App.js` or the CSS file at `app/javascript/App.css` and observe the HMR goodness.

Note that HMR will not work if you edit `app/javascript/application.js` and experience a full refresh with a warning in the console. For more info on this, see here: https://github.com/pmmmwh/react-refresh-webpack-plugin/issues/177
Note that HMR will not work if you edit `app/javascript/packs/application.js` and experience a full refresh with a warning in the console. For more info on this, see here: https://github.com/pmmmwh/react-refresh-webpack-plugin/issues/177

0 comments on commit 6e769d2

Please sign in to comment.