Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wire up redux and react-navigation #7

Merged
merged 1 commit into from Jan 7, 2018
Merged

Wire up redux and react-navigation #7

merged 1 commit into from Jan 7, 2018

Conversation

brettdh
Copy link
Contributor

@brettdh brettdh commented Jan 3, 2018

Initial bare-bones experimentation to get something working. Very rough;
will change considerably, soon. The next iteration will actually have some
sample Redux code to close the loop on how some simple app activities
(such as logging in) will get accomplished using actions and reducers.

Also missing lots of documentation, sadly. Will try to get to that tomorrow.

Main design decisions that I'm proposing (feedback welcome):

  • Use React Navigation for app navigation
  • Use Redux to store all application state
    • Unless there's a clear reason to put something elsewhere
    • This includes navigation state
  • Use the Ducks approach to organizing state management code
  • Use redux-thunk for async actions
    • At least to start.
    • I really want to try out RxJS and redux-observable but that seems like a large learning chunk to bite off for a team with a lot of people new to Redux. (Feel free to tell me I'm wrong about that, though.)

@brettdh brettdh requested review from samchurney and a team January 3, 2018 00:24
@brettdh
Copy link
Contributor Author

brettdh commented Jan 3, 2018

Note: I had to disable the Flow pre-commit check, because it was checking react-navigation itself, which introduced well over a hundred errors. I imagine there's a way to suppress that; I'll make an issue to look into that later.

@brettdh brettdh added this to In progress in User Stories and Bugs Jan 3, 2018
@brettdh brettdh moved this from In progress to Needs review in User Stories and Bugs Jan 3, 2018
Copy link
Contributor

@wittjosiah wittjosiah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to run this successfully and it works like you would expect. Pretty much everything looks fine to me. One thing I would say is that I think its best to avoid eslint-disable-next-line if possible, so if there's gonna be a bunch of those then might want to consider making it the general rule.

@brettdh
Copy link
Contributor Author

brettdh commented Jan 7, 2018

Opened #10 for the Flow issues with react-navigation.

@brettdh
Copy link
Contributor Author

brettdh commented Jan 7, 2018

One thing I would say is that I think its best to avoid eslint-disable-next-line if possible

I agree in general. In these cases, I used it for a few specific rules, so let's enumerate and discuss them here:

  1. react/no-typos
  2. react/forbid-prop-types
    • This is to avoid a complaint about using the object PropType. I will try again to fix this.
  3. import/prefer-default-export
    • I think these will go away as we add more actions, etc. I would be okay with disabling this rule globally, since I think it's reasonable to create a module and anticipate that it will eventually have more than one named export. I also think it's better to create the export as you intend it in that module, so that you don't have to change how it's imported later when you add a second named export.

@brettdh
Copy link
Contributor Author

brettdh commented Jan 7, 2018

Unfortunately, the bug in eslint-plugin-react means that the rule disallows all custom prop types, since they're not in the list that the prop-types lib exports. This seems like an oversight in the rule implementation, but besides this issue, it seems like a very useful rule, so despite the duplication it causes, for now I'm just not creating custom PropTypes.

Initial bare-bones experimentation to get something working. Very rough;
will change considerably, soon.
@brettdh brettdh merged commit 2ca8116 into master Jan 7, 2018
User Stories and Bugs automation moved this from Needs review to Done Jan 7, 2018
@brettdh brettdh deleted the redux-start branch January 7, 2018 20:38
@brettdh brettdh added this to the First "sprint" milestone Jan 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants