This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-07
Channels
- # announcements (3)
- # beginners (124)
- # calva (60)
- # cider (81)
- # cljs-dev (65)
- # cljsrn (1)
- # clojure (268)
- # clojure-dusseldorf (2)
- # clojure-europe (3)
- # clojure-italy (9)
- # clojure-losangeles (1)
- # clojure-nl (22)
- # clojure-russia (3)
- # clojure-spec (24)
- # clojure-uk (34)
- # clojurescript (72)
- # code-reviews (8)
- # cursive (20)
- # datomic (32)
- # fulcro (49)
- # jobs (1)
- # jobs-discuss (15)
- # juxt (10)
- # lein-figwheel (10)
- # nrepl (4)
- # off-topic (37)
- # overtone (1)
- # portkey (2)
- # protorepl (8)
- # random (1)
- # re-frame (1)
- # reagent (43)
- # reitit (8)
- # ring (16)
- # ring-swagger (2)
- # rum (6)
- # shadow-cljs (63)
- # specter (2)
- # testing (32)
- # tools-deps (32)
- # unrepl (1)
- # vim (3)
RIght, so there isn't a literal in Hiccup to produce it. Does Reagent have an equivalent macro that I haven't found?
boot.user> (prn (hiccup.core/html
(list "<!doctype html>"
[:html
[:head
[:title "hi page"]]
[:body
[:h1 "hi"]]])))
"<!doctype html><html><head><title>hi page</title></head><body><h1>hi</h1></body></html>"
QQ: Reagent form-1
and form-2
components: do they become React function components, or class components? I was under the impression it was function components until you get to form-3
.
@lilactown Not really, I just need a dynamic index.html.
No actually, not really. That can be done easily enough with a static index.html. I need to modify the content of <head>
based on configuration, which is why I'm generating the index page rather than having a static one.
Yeah, indeed, I am doing it on the server side. Just a simple Reagent component, rendered to string rather than mounted. I haven't used react-helmet, I'll check it out.
React-helmet doesn't seem to provide anything that isn't already possible with plain Reagent, TBH.
ohhhh, that's wild.
@tkjone https://github.com/reagent-project/reagent/blob/master/doc/CreatingReagentComponents.md
Only form-3 calls reagent/create-class
so I don't know if that's true
After using reagent for 4 years or so, I'm stuck on a project that is vanilla javascript :face_with_rolling_eyes: ... After using redux (horrible), I've been trying to look into other JS libraries that make things feel as easy as reagent. How did reagent manage to avoid the inherited state/props problem that's so pervasive in vanilla react?
It's just super nice that there's a global atom that you can update and not have to worry about that atom being passed in as props to the component.
I could be wrong, but my understanding of the difficulties developers have with state/props is not writing in the functional style as JS is a hybrid language. I managed to get around those issues myself by sticking to a strict functional style. Since Clojure(Script) is functional only it enforces that.
It's confusing for me to that I need to make callbacks to set the state of a higher level component and then pass the state down as props to the lower components. It becomes really confusing really quickly and then i lose shared state with different containers.
Have you checked out re-frame? I've found it to be helpful in managing those concerns
Oh, right. You said you're stuck on vanilla JS
I was using redux. I can check out re-frame. I just find that there's way too much boilerplate code in redux so far. Actions/Sagas/Constants/Reducers.... things that i would make as a single function in reagent.
I avoid redux like the plague myself. It overcomplicates way too much
re-frame provides a micro-framework since you're going to build one yourself anyway if you just use pure reagent. I've found it to be helpful in reinforcing the flow by how it is designed
Personally I found JS libraries that force functional are more complicated than they need to be and I just enforce myself
they do this weird thing in redux
export default connect(
mapStateToProps,
mapDispatchToProps
)(CraneVideoDayContainer);
The normal way suggested in the React docs. I've found if you're having trouble with props then that may be indicating a design flaw
In those cases I've restructured components in a slightly different way that flowed as intended
@jdkealy you can try out MobX. React's new(er) Context API is also nice for getting rid of drilling props down multiple levels
but AFAICT MobX is (architecturally) quite similar to reagent, with much more ceremony