From 6e769d27ad21a98423b207213b5a09aee602c1e0 Mon Sep 17 00:00:00 2001 From: Rian Rainey Date: Thu, 12 Sep 2024 05:02:59 -0400 Subject: [PATCH] Update react.md (#514) 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. --- docs/react.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/react.md b/docs/react.md index b2320aff..25847558 100644 --- a/docs/react.md +++ b/docs/react.md @@ -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) @@ -152,7 +152,7 @@ echo '
' > 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'; @@ -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