reagent-project / reagent

A minimalistic ClojureScript interface to React.js
http://reagent-project.github.io/
MIT License
4.75k stars 415 forks source link

Idiomatic way to avoid expected behavior with component should update #181

Closed ClashTheBunny closed 9 years ago

ClashTheBunny commented 9 years ago

I have seen a couple places where component-should-update isn't called when a deref'ed atom is the reason for an update. Both #113 and http://stackoverflow.com/questions/27050312/reagent-should-component-update-not-called explain that this is expected to happen. Is there an idiomatic way of doing what people have done with react with d3 and overriding the component update procedures? The two methods I've seen involve always returning false for component should update and then manually having d3 update: http://nicolashery.com/integrating-d3js-visualizations-in-a-react-app/ and http://ahmadchatha.com/writings/article1.html

I'm trying to make a graph, using d3, that updates based on new data from a ratom. Both of the above links have the react way of doing things, but that doesn't work with reagent's component should update.

mike-thompson-day8 commented 9 years ago

@ClashTheBunny have a quick look at my 11:21:11 comment in here: http://clojurians-log.mantike.pro/re-frame/2015-07-17.html

Here is Ducky answering similar: http://stackoverflow.com/a/31521631/5215391

See also: http://nils-blum-oeste.net/clojurescripts-reagent-using-props-in-lifecycle-hooks/

In the future, could you ask these sorts of questions via one of the help forums, rather than raising an issue here which is noisy for a lot of people:

mike-thompson-day8 commented 9 years ago

@ClashTheBunny I was just reminded by @gadfly361 of this related link: https://gist.github.com/jhchabran/e09883c3bc1b703a224d#file-2_google_map-cljs