Fork me on GitHub
#cljsrn
<
2019-10-19
>
Maksym15:10:14

Hi, I want to fetch data from server every time I render view, I found that React Native lifecycle event getDerivedStateFromProps runs right before every call of render function, I've tried to write simple call of this event but I got an error:

Warning: %s: getDerivedStateFromProps() is defined as an instance method and will be ignored. Instead, declare it as a static method., reagent1
- node_modules\react-native\Libraries\YellowBox\YellowBox.js:59:8 in error
- node_modules\expo\build\environment\muteWarnings.fx.js:27:24 in error
- ... 22 more stack frames from framework internals
My code is:
(defn warehouses-screen []
  (r/create-class
   {:reagent-render
    (let [warehouses (rf/subscribe [:warehouses])]
      (fn [props]
        [c/view {:style []}
...
         ]))
    :get-derived-state-from-props
    (fn [this nextProps nextState] (prn "!!!getDerivedStateFromProps!!!" ))}))
How can I declare a static method?