-
Notifications
You must be signed in to change notification settings - Fork 755
Inline props operations improvement #306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…scaped data to the end of body. This makes markup more clean and simple and reduces required bandwith for highload applications.
Hi thanks for updating this, I'm sorry it's sat cold for quite some time! I hope to add an extension point for the view helper much like we have for transforming JSX & server rendering. Then you could define some class with the inspected behavior and inject it during configuration. That allows us to have lots of different options without packing too much behavior into one class or method. Thanks again for your work on identifying this problem & proposing a solution, I'll follow up soon! |
Hoping to support more customization of the view helper with #346 ! That way you could distribute a custom helper & renderer in a gem and hook them up with a railtie. |
I would like present a GEM for this PR: |
Nice! Glad that worked out. |
Problem
1.1 Process in browser devtools. So that browser stucks trying to render markup for preview.
1.2 Deliver it to user due to bandwidth (for highload apps).
So props we want to place:
are looking like this:
Solution
Moving inline props to the
<script type="text/json">{"foo": "bar"}</script>
will:Placing inline props at the end of body speeds up DOM rendering and allows Turbolinks to load this data along with other markup on each request.
How it works
The process of placing the components to the markup in Rails is still the same except of developer should add
<%= render_react_props %>
at the end of<body>
tag.