{"id":750,"date":"2020-07-28T14:08:06","date_gmt":"2020-07-28T14:08:06","guid":{"rendered":"https:\/\/bruceng.com\/dev\/?p=750"},"modified":"2020-07-28T14:08:50","modified_gmt":"2020-07-28T14:08:50","slug":"child-component-state-not-updated-in-flutter","status":"publish","type":"post","link":"https:\/\/bruceng.com\/dev\/?p=750","title":{"rendered":"Child component state not updated in Flutter."},"content":{"rendered":"\n<p>It seems that when child component has its own state which is created by passing from the parent component&#8217;s state, if the parent component changes the state and try to re-create the child component with this new state passing in as a parameter for the constructor, the child somehow still uses its old state.<\/p>\n\n\n\n<p>Maybe the rule of thumb is, state should only be changed by the direct owner of the state, not the containers?<\/p>\n\n\n\n<p>Anyway I solved this issue by converting the child component into a StatelessWidget in Flutter, still trying to get my head around this Unidirection data flow pattern created by React.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It seems that when child component has its own state which is created by passing from the parent component&#8217;s state, if the parent component changes the state and try to re-create the child component with this new state passing in as a parameter for the constructor, the child somehow still uses its old state. Maybe &hellip; <a href=\"https:\/\/bruceng.com\/dev\/?p=750\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Child component state not updated in Flutter.&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[110,109],"class_list":["post-750","post","type-post","status-publish","format-standard","hentry","category-problems","tag-dart","tag-flutter"],"_links":{"self":[{"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/posts\/750","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=750"}],"version-history":[{"count":2,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/posts\/750\/revisions"}],"predecessor-version":[{"id":752,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=\/wp\/v2\/posts\/750\/revisions\/752"}],"wp:attachment":[{"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=750"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=750"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bruceng.com\/dev\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}