praveenperera

praveenperera

Turbolinks with Phoenix

How We Replaced React with Phoenix
By: Thought Bot

Most Liked

homanchou

homanchou

Any one tried Morphdom? GitHub - patrick-steele-idem/morphdom: Fast and lightweight DOM diffing/patching (no virtual DOM needed) · GitHub

Supposedly simple way to update parts of DOM preserving states like input cursor positions

As described in this well written blog post: Accelerate your developer workflow | Namespace

It feels like I’m seeing more of the “replaced react with traditional rails/turbo-links” type of posts suggesting web-dev is coming round full circle:

Early 2000’s.
Full page refresh is the standard. Works great.
Sprinkle in a little js. Works good.
Add more js, jquery mess. Not so good.
SPA everything. Explosion of frameworks and tools. Total confusion, increased development time.
Now:
No more SPA. Go back to full traditional full page refresh. Hey, still works great!
Now add back a little js… :wink:
(continue…)

nerdyworm

nerdyworm

As promised a Phoenix, Turbolinks, React, Redux, and Immutable.js example. Redux and Immutable are not a requirement for this setup, but they make frontend work a tad more enjoyable for me :slight_smile:

source: GitHub - nerdyworm/returb: Phoenix, Turbolinks, React.js, Redux, Immutable.js example app. · GitHub
demo: https://sleepy-shore-92135.herokuapp.com (disclaimer: user editable content on the internets)

Pain Points/Things I haven’t figured out:

  1. Mix of html, server side js, and json serialization are required to get everything working in a real app. Full SPA would only require json.
  2. I’d really like to override the redirect function instead of: returb/web/turbolinks.ex at master · nerdyworm/returb · GitHub
  3. Turbolinks caching and react components that change state cause some screen flickering. My current solution is to basically just bust the cache on state changes.
  4. Remote forms are a bit tricky to get right when react.js components are involved.
  5. Flash messages are not working, not sure why. Probably simple.
  6. You have to go all in with Turbolinks if you have any components that depend on global state. I actually have not run into this yet, but I can see it happening in a full featured app.

I do not have that much experience with React and elixir. I could be doing it totally wrong. If I am please help :wink:

If there are any questions just ping me and I’ll be happy to help.

Cheers,
Ben

nerdyworm

nerdyworm

I’ve been toying around with a turbolinks/react apps lately. So far it seems quite solid. Turbolinks makes all the crud stuff seem snappy and react allows for the higher fidelity UI to be well designed and sprinkled throughout the app. It has pain points, but far fewer pain points then going full SPA.

If enough folks are interested in this I would be more than happy to extract a demo app out of my project.

Where Next?

Popular in Discussions Top

jeramyRR
This is an interesting article to read. Elixir’s performance, like usual, is excellent. However, it seems like the high CPU usage is co...
New
Qqwy
Looking at the stacks that existing large companies have used, WhatsApp internally uses Mnesia to store the messages, while Discord uses ...
New
axelson
Decided against including more info in the title, but the gist is that Plataformatec sponsored projects will continue with the assets bei...
New
arcanemachine
https://nitter.net/josevalim/status/1744395345872683471 https://twitter.com/josevalim/status/1744395345872683471
New
crispinb
On reading dhh’s latest The One Person Framework it strikes me that Phoenix with LiveView is already pretty much this. However, never hav...
New
AstonJ
If a newbie asked you about Phoenix Contexts, how would you explain the basics to them? Feel free to be as concise or in-depth as you li...
New
restack_oslo
Hello, Please pardon me for any faux paux. I am 46 and this is my first time on a forum of any kind. I wanted to to get answers from tho...
New
chulkilee
Here are the list of HTTP client libraries/wrappers, and some thoughts on HTTP client in general. I’d like to hear from others how they w...
New
AstonJ
If so I (and hopefully others!) might have some tips for you :slight_smile: But first, please say which area you’re finding most challen...
New
Markusxmr
Since Drab has been developed for a while in the open, introducing the Liveview functionality in a way it happend appears to undermine th...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29377 241
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52341 488
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement