Fork me on GitHub
#clojurescript
<
2022-04-26
>
grounded_sage05:04:23

Has anyone built a browser based playground for cljs. One where you can also pull in dependencies? I'm almost certain I've seen something before.

thheller05:04:24

anything wanted to pull in dependencies really needs something server side. can't really install npm packages and cljs maven deps from the browser only

grounded_sage06:04:25

Yea stackblitz did it but that's like super heavy handed with their approach and also not open source on how they did it so… Yea I guess the best you could do is pull in scripts from GitHub maybe.

thheller06:04:51

well, my playground thing is getting the data from a github gist https://gist.github.com/thheller/46c384e10868df60b7d4634f0f06b26b

thheller06:04:52

that works fine, not sure how you'd do multi namespace kind of examples though

thheller06:04:49

can't remember names of the others right now but there are some

pinkfrog12:04:33

Hi. A reagent (react) question, how can I refer to a sibling component?

(defn example-screen
  []
  [RN/view {:style (tw "bg-sky-200 h-full items-center")}
   [RN/text-input ]
   [RN/button {:on-press (fn [] ("how to refer to the value of the sibling text-input?"))}]])

cjohansen12:04:38

You probably want to be very careful with coupling like that, but you’ll need to take the element as argument to the handler and do (.. e -previousElementSibling -value) or soemthing similar

p-himik12:04:15

I'd use refs for that.

p-himik12:04:41

Along with #reagent ;)

pinkfrog12:04:48

Ref sounds interesting.

cjohansen12:04:05

Yeah, that’s better, should’ve thought of that 😅

pinkfrog13:04:32

@U2FRKM4TW I couldn’t find the field that contains the text of textinput. The closest is https://reactnative.dev/docs/textinput#value but seems irrelevant.

p-himik13:04:21

No clue about RN, but judging by that page, it expects you to have a controlled component with onChangeText where you manage the state yourself. In that case, you don't need a ref - just reset an atom on edit and refer to that atom in the other component.

p-himik13:04:46

Given that you don't seem to need to re-render anything on text change, you can use a regular atom and not a ratom.

pinkfrog13:04:17

Yup. RN could be something different from dom (react dom).