Hi all
I have the following component, that do in the didMount
lifecycle fetch data from server.
let make = (~server: CoinsType.coinsServer, ~url: string, _children) => {
...component,
didMount: _self => {
server.fetcher(url)
|> Js.Promise.then_(value => {
Js.Promise.resolve(ReasonReact.Update({coins: value}));
});
ReasonReact.NoUpdate;
},
initialState: () => {coins: [||]},
reducer: (action, _state) =>
switch (action) {
| Fetch => ReasonReact.NoUpdate;
},
render: self => {
<div>
<DashboardView coins={self.state.coins}/>
</div>;
},
};
The DashboardView
component did not get the value from new set value in the didMount
lifecycle.
The question is, how to force to re-render component, that theDashboardView
component will receive the value.
Thanks