1. 3
  1. 1

    Thanks for sharing.

    Would be interested to know why Redux vs React.Context (in my case, by the time I needed the app-scope state sharing, React.Context was already available, so I never got a chance leverage Redux).

    I also use ReactRouter, primarily because it has integration for React-native. It is elegant, in my view. For more complex styling I use React-Bootstrap.

    But overall, I also tend to pick components that can work with React Native and React Native web – so that I can reduce my ‘cognitive load’ required to maintain web and mobile end-user apps for the same system.

    May be this is outside of your scope, but would be interesting to understand if the proposed directory structure can be extended to handle code sharing between react native (mobile) and web apps (eg sharing some navigation logic, forms, and having different styling). In my experience, this is somewhat ‘non-obvious’ (but I also conceded that I might have not solved it in the best way).

    1. 2

      Sorry, I missed this post.

      Regarding Context vs. Redux, I originally used Context when it was new, but I was using Context with React classes. In that time, you could only consume one Context per class component, and that was a problem, so I eventually refactored everything to use Redux.

      Later, Hooks came out, and multiple Contexts are now able to be used in functional components, so that solves that issue. However, Redux comes with a lot of great things like time travel debugging and the Redux DevTools that make development so much easier. I would still use Redux for the main state management, and I use Context for smaller contained widgets.

      As for code sharing, I think a 3rd library to share between web and mobile for React components would make the most sense.