Fork me on GitHub

Hi everybody I'm conditionally mounting some components


but apparently react doesn't like that style


(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.


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...


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


why is this bad x.x