Redux & React Native: UI does not update on state change The Next CEO of Stack...

Is it correct to say moon starry nights?

How to use ReplaceAll on an expression that contains a rule

A question about free fall, velocity, and the height of an object.

How did Beeri the Hittite come up with naming his daughter Yehudit?

How to get the last not-null value in an ordered column of a huge table?

Is fine stranded wire ok for main supply line?

Computationally populating tables with probability data

Film where the government was corrupt with aliens, people sent to kill aliens are given rigged visors not showing the right aliens

Do scriptures give a method to recognize a truly self-realized person/jivanmukta?

Can Sneak Attack be used when hitting with an improvised weapon?

From jafe to El-Guest

Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?

Purpose of level-shifter with same in and out voltages

Can this note be analyzed as a non-chord tone?

Is it convenient to ask the journal's editor for two additional days to complete a review?

Traduction de « Life is a roller coaster »

Can you teleport closer to a creature you are Frightened of?

Do I need to write [sic] when including a quotation with a number less than 10 that isn't written out?

Scary film where a woman has vaginal teeth

In the "Harry Potter and the Order of the Phoenix" video game, what potion is used to sabotage Umbridge's speakers?

How do I fit a non linear curve?

Aggressive Under-Indexing and no data for missing index

What is the process for cleansing a very negative action

Is it professional to write unrelated content in an almost-empty email?



Redux & React Native: UI does not update on state change



The Next CEO of Stack OverflowHelp! Attempting to install PowerShell 2 from Windows Management Framework, getting “The update does not apply to your system”Skype does not start on Vista 64Web page does not display properlyMonitor does not turn on until resetDVD-RW does not read regular CDS/DVDs on VistaSystem does not boot with DisplayPort plugged inCD Rom Door Does Not ShutCD-Rom does not show up in My ComputerHow to troubleshoot a program that does not startAfter a windows update restart explorer.exe does not load












0















I'm brand new to Redux, and relatively new to programming in general. 
I'm definitely open to any extra advice beyond the scope of my question.



So within the state of my Redux Store, I have a key called "count: 0"
On the main page of my app, when the user clicks the main button, the count is supposed to increment by 1. Here's how that code looks.



<--Action.js-->

import { store } from './store'

export const click = (amount) => ({
type: "CLICK",
count: store.getState().count + amount
})

<--Reducer.js-->

export default (state, action) => {
switch (action.type) {
case "CLICK":
return {
...state,
count: action.count
};
default:
return state;
}
};

<--Store.js-->


import { createStore } from 'redux';

import reducer from './reducer';

export const initialState = {
count: 0
};

export const store = createStore(reducer, initialState);


For some reason, when I console.log(store.getState()), the console.log shows that the count is in fact incrementing, but on the actual UI, it remains 0. 
Any guidance as to why this may be happening would be greatly appreciated!



The link to the full project can be found here: https://github.com/EmilioLombana/Pizza-Clicker










share|improve this question









New contributor




Emilio Lombana is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I'm brand new to Redux, and relatively new to programming in general. 
    I'm definitely open to any extra advice beyond the scope of my question.



    So within the state of my Redux Store, I have a key called "count: 0"
    On the main page of my app, when the user clicks the main button, the count is supposed to increment by 1. Here's how that code looks.



    <--Action.js-->

    import { store } from './store'

    export const click = (amount) => ({
    type: "CLICK",
    count: store.getState().count + amount
    })

    <--Reducer.js-->

    export default (state, action) => {
    switch (action.type) {
    case "CLICK":
    return {
    ...state,
    count: action.count
    };
    default:
    return state;
    }
    };

    <--Store.js-->


    import { createStore } from 'redux';

    import reducer from './reducer';

    export const initialState = {
    count: 0
    };

    export const store = createStore(reducer, initialState);


    For some reason, when I console.log(store.getState()), the console.log shows that the count is in fact incrementing, but on the actual UI, it remains 0. 
    Any guidance as to why this may be happening would be greatly appreciated!



    The link to the full project can be found here: https://github.com/EmilioLombana/Pizza-Clicker










    share|improve this question









    New contributor




    Emilio Lombana is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I'm brand new to Redux, and relatively new to programming in general. 
      I'm definitely open to any extra advice beyond the scope of my question.



      So within the state of my Redux Store, I have a key called "count: 0"
      On the main page of my app, when the user clicks the main button, the count is supposed to increment by 1. Here's how that code looks.



      <--Action.js-->

      import { store } from './store'

      export const click = (amount) => ({
      type: "CLICK",
      count: store.getState().count + amount
      })

      <--Reducer.js-->

      export default (state, action) => {
      switch (action.type) {
      case "CLICK":
      return {
      ...state,
      count: action.count
      };
      default:
      return state;
      }
      };

      <--Store.js-->


      import { createStore } from 'redux';

      import reducer from './reducer';

      export const initialState = {
      count: 0
      };

      export const store = createStore(reducer, initialState);


      For some reason, when I console.log(store.getState()), the console.log shows that the count is in fact incrementing, but on the actual UI, it remains 0. 
      Any guidance as to why this may be happening would be greatly appreciated!



      The link to the full project can be found here: https://github.com/EmilioLombana/Pizza-Clicker










      share|improve this question









      New contributor




      Emilio Lombana is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I'm brand new to Redux, and relatively new to programming in general. 
      I'm definitely open to any extra advice beyond the scope of my question.



      So within the state of my Redux Store, I have a key called "count: 0"
      On the main page of my app, when the user clicks the main button, the count is supposed to increment by 1. Here's how that code looks.



      <--Action.js-->

      import { store } from './store'

      export const click = (amount) => ({
      type: "CLICK",
      count: store.getState().count + amount
      })

      <--Reducer.js-->

      export default (state, action) => {
      switch (action.type) {
      case "CLICK":
      return {
      ...state,
      count: action.count
      };
      default:
      return state;
      }
      };

      <--Store.js-->


      import { createStore } from 'redux';

      import reducer from './reducer';

      export const initialState = {
      count: 0
      };

      export const store = createStore(reducer, initialState);


      For some reason, when I console.log(store.getState()), the console.log shows that the count is in fact incrementing, but on the actual UI, it remains 0. 
      Any guidance as to why this may be happening would be greatly appreciated!



      The link to the full project can be found here: https://github.com/EmilioLombana/Pizza-Clicker







      troubleshooting






      share|improve this question









      New contributor




      Emilio Lombana is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Emilio Lombana is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 46 mins ago









      Scott

      16.1k113990




      16.1k113990






      New contributor




      Emilio Lombana is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 1 hour ago









      Emilio LombanaEmilio Lombana

      1




      1




      New contributor




      Emilio Lombana is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Emilio Lombana is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Emilio Lombana is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Emilio Lombana is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1419766%2fredux-react-native-ui-does-not-update-on-state-change%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Emilio Lombana is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Emilio Lombana is a new contributor. Be nice, and check out our Code of Conduct.













          Emilio Lombana is a new contributor. Be nice, and check out our Code of Conduct.












          Emilio Lombana is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1419766%2fredux-react-native-ui-does-not-update-on-state-change%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...

          Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

          VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...