If the same Reagent form-2 is used in two different scenes, and you click back and forth between their tabs, the closed over data is retained between clicks.
(ns demo.form-2-not-switching-demo
(:require [portfolio.reagent :refer-macros [defscene]]))
(defn my-form2-component [num]
;;This is a silly, non-real-world example.
;;Normally, you'd let a r/atom to have local state,
;;or maybe trigger side effects that should only
;;happen on-mount.
;;But nothing more than this is needed
;;To demonstrate the problem.
(let [result (+ 5 num)]
(fn [_]
[:div result])))
(defscene first-demo
:params 1
[params]
[my-form2-component params])
(defscene second-demo
:params 2
[params]
[my-form2-component params])
;;Now, click each tab in succession.
;;The displayed number will remain the same.
If the same Reagent form-2 is used in two different scenes, and you click back and forth between their tabs, the closed over data is retained between clicks.