Sha256: 6de03ec2742d98d7cc3354771daa4460c681fefb6822b09667961cc0723a0efd

Contents?: true

Size: 873 Bytes

Versions: 31

Compression:

Stored size: 873 Bytes

Contents

# Server Rendering Tips

- Your code can't reference `document`. Server side JS execution does not have access to `document`, so jQuery and some
  other libs won't work in this environment. You can debug this by putting in `console.log`
  statements in your code.
- You can conditionally avoid running code that references document by passing in a boolean prop to your top level react
  component. Since the passed in props Hash from the view helper applies to client and server side code, the best way to
  do this is to use a generator function.
- If you're serious about server rendering, it's worth the effort to have different entry points for client and server rendering. It's worth the extra complexity.

The point is that you have separate files for top level client or server side, and you pass some extra option indicating that rendering is happening server sie.

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
react_on_rails-2.2.0 docs/additional_reading/server_rendering_tips.md
react_on_rails-2.1.1 docs/additional_reading/server_rendering_tips.md
react_on_rails-2.1.0 docs/additional_reading/server_rendering_tips.md
react_on_rails-2.0.2 docs/additional_reading/server_rendering_tips.md
react_on_rails-2.0.1 docs/additional_reading/server_rendering_tips.md
react_on_rails-2.0.0 docs/additional_reading/server_rendering_tips.md
react_on_rails-2.0.0.rc.4 docs/additional_reading/server_rendering_tips.md
react_on_rails-2.0.0.rc.3 docs/additional_reading/server_rendering_tips.md
react_on_rails-2.0.0.rc.1 docs/additional_reading/server_rendering_tips.md
react_on_rails-2.0.0.beta.3 docs/additional_reading/server_rendering_tips.md
react_on_rails-2.0.0.beta.2 docs/additional_reading/server_rendering_tips.md