Skip to content

react_on_rails/Turbolinks Issues after webpacker to shakapacker upgrade #324

Closed Answered by wb-ts
MikaelHTW asked this question in Q&A
Discussion options

You must be logged in to vote

Hello! It seems like you're facing some issues with the integration of React on Rails and Turbolinks after upgrading to Shakapacker 6.6.0 and Webpack 5. I understand that moving your main JavaScript pack back into the <head> of the DOM solves the useContext Invalid Hooks Error, but causes other bugs.

Here are a few suggestions you can try:

  1. Ensure correct configuration: Verify that your Webpack configuration is set up correctly for React on Rails. Make sure that React and ReactDOM are excluded from the global scope and are properly bundled as external dependencies.

  2. Disable Turbolinks for specific pages: If the issue mainly occurs on certain pages where Turbolinks is not required, you c…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
3 replies
@MikaelHTW
Comment options

@justin808
Comment options

@MikaelHTW
Comment options

Comment options

You must be logged in to vote
2 replies
@jjla26
Comment options

@Judahmeek
Comment options

Answer selected by LewWadoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants