3

I am facing problem when making prerender: true, any way to fix it?

Encountered error "ReferenceError: $ is not defined" when prerendering Store with {"data":{"results":708,"total_pages":59,"previous_page":null,"next_page":2,"designs":

1 Answer 1

10

You might need to require the jquery package. I'm running an isomorphic server rendered app and had to include var $ = require ('jquery') (after installing it -- npm install --save jquery) on all the components that reference jQuery.

Sign up to request clarification or add additional context in comments.

1 Comment

For further understanding: The issue is that when pre-rendering your JS, react-rails doesn't have access to document or the Global scope (see Docs). I assume you include $ through the document and not your package manager so it's only present globally within the browser.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.