Fork me on GitHub
#rum
<
2020-09-23
>
sova-soars-the-sora23:09:19

Hi everybody I'm conditionally mounting some components

sova-soars-the-sora23:09:25

but apparently react doesn't like that style

sova-soars-the-sora23:09:56

(rum/defc cumulative-quiz < rum/reactive 
 {:key-fn (fn [] (str "quizd-cumulative" (swap! ugen inc)))} []
  			(println @rand-int-majore " = majore")
					(if (= 0 (rum/react rand-int-majore))			 ;VERBQUIZ
							(rum/mount (verb-quiz-cumulative) (. js/document (getElementById "app"))))
 				(if (= 1 (rum/react rand-int-majore)) ;;;KANJIQUIZ
	       (rum/mount (kanji-quiz-cumulative) (. js/document (getElementById "app"))))

				(if (= 2 (rum/react rand-int-majore))	;;PARTICLE quiz
       (rum/mount (particle-quiz-cumulative) (. js/document (getElementById "app")))))
Here I am combining 3 elements into one and I thought I could just conditionally rum/mount the relevant one.

sova-soars-the-sora23:09:01

how would you conditionally show 1 of 3 slides and randomly move to the next one? for example, you have slide A, B, C, each with on-the-fly data... how would you show A or Bor C and then randomly draw again and show A or B or C...

sova-soars-the-sora23:09:23

I figured I could just store an atom with a value 0 1 2 and randomly roll it every time I needed the update, and have the component selectively mount pieces

sova-soars-the-sora23:09:31

why is this bad x.x