diff --git a/doc/ReactFeatures.md b/doc/ReactFeatures.md index 3414b6d..cf81caa 100644 --- a/doc/ReactFeatures.md +++ b/doc/ReactFeatures.md @@ -70,7 +70,7 @@ Alternatively you can use the [static contextType property](https://reactjs.org/ ``` Tests contain example of using old React lifecycle Context API (`context-wrapper` function): -[tests](https://github.com/reagent-project/reagent/blob/master/test/reagenttest/testreagent.cljs#L1141-L1165) +[tests](https://github.com/reagent-project/reagent/blob/master/test/reagenttest/testreagent.cljs#L1159-L1168) ## [Error boundaries](https://reactjs.org/docs/error-boundaries.html) diff --git a/test/reagenttest/testreagent.cljs b/test/reagenttest/testreagent.cljs index cf82b31..d1d11a3 100644 --- a/test/reagenttest/testreagent.cljs +++ b/test/reagenttest/testreagent.cljs @@ -1257,7 +1257,16 @@ (rstr [:> Provider {:value "bar"} [:> Consumer {} (fn [v] - (r/as-element [:div "Context: " v]))]]))))) + (r/as-element [:div "Context: " v]))]])))) + + (testing "static contextType" + (let [comp (r/create-class + {:context-type my-context + :reagent-render (fn [] + (this-as this + (r/as-element [:div "Context: " (.-context this)])))})] + (is (= "