-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Are there any examples of a full project that use redux-starter-kit? #99
Comments
Writing both a "Usage Guide" page and a couple of full-blown example apps has been on my todo list for a while, but not sure when I'll have time to get to it. The best example atm is someone's "Redux is too complicated!!!!!" comparison app that I refactored to use RSK a while back: In general, you ought to be able to:
The |
Ideally, i would love to see an example based on
|
@Sharlaan : RSK doesn't do anything about "preventing useless rerendering" atm, other than including But yeah, I'd love to see some RSK examples put together, I just don't have time to write any myself right now. |
Yeah, plus one. I believe that "the starter kit" should give a good introduction to the overall picture, it's really "nice-to-have" feature for docs. Especially it would be cool to see a project based on RSK with typescript — properly used types and other stuff. So far, I've found two great guides about redux+typescript in common: But it's not enough to find answers for all tricky moments and absolutely nothing about RSK. |
As I said, I'd love to see example projects created, but I've got other priorities atm. I did just publish a "Usage Guide" docs page, which hopefully should help: |
@JarLowrey, I second your comment. I'm trying to use RSK at work, but couldn't find a good sample app to base some of the use cases on. @markerikson, could you please let us know if there's been some dev work on this? I saw this PR: |
No "full" projects to show off atm, I'm afraid. That said, I have taken two small projects that other people wrote first, and filed PRs showing how to convert them to RSK to simplify the code: https://www.reddit.com/r/reactjs/comments/bhb3bc/react_redux_with_hooks_using_new_reactredux_71/ Hopefully those at least help a bit. (Also, that PR is way out of date by now.) |
Not a problem @markerikson, thank you for the existing links. Sorry for not specifically mentioning this in the previous comment, but I'm looking for an app that also demonstrates testing a slice or a reducer created using RSK. If I am able to figure it out, I would like to contribute the sample app to this repo. :) |
I recently implemented a small project using redux-starter-kit and hooks api from [email protected]. It works really well, the only bit I had trouble with was getting redux-thunk to work. I finally figured out it should not be part of reducers in createSlice. https://github.com/zhuoli99/radiotrax-code-challenge |
@zhuoli99 : yeah, several folks seem to be making that same mistake. I haven't yet figured out how to explain that one correctly, but I probably ought to update the docs somehow. Also, I glanced through the repo. Very nice work! :) |
Let me chime in too: I am also working on a |
Yeah, I've got a small example project at https://github.com/markerikson/rsk-github-issues-experiment that I'm hoping to turn into a tutorial page. |
Its still a WIP, but I've created https://github.com/adammlr/react-sample that uses slices, createSelector, async actions, and hooks. Open to feedback as I'm going to use this for a larger project. |
Here is what I am working on (very WIP, still learning): Ideally this will also have MobX, Apollo, and other state providers. I am hoping to turn it into some sort of tutorial / comparison. PS: I am gladly accepting help / suggestions |
Resolved now that the "Advanced" tutorial is done: https://redux-starter-kit.js.org/tutorials/advanced-tutorial |
@markerikson First off, these new tutorials have been extremely instructive, thanks a ton for putting them together! However, from talking to others in the community, it seems like there is large teaching gap surrounding testing best practices. Would be be able re-open this ticket (or start a new one), to start hammering out best practices for testing, mocking, and stubbing slices? |
If there's a need for other docs, go ahead and open up a separate issue. That said, there shouldn't be anything specific needed for "slices" that would be any different than testing "vanilla" Redux logic. Reducers are trivial to test (and as of 1.0 you can test the individual case reducers if you want), and there's no need to test the generated action creators. That's all that's in a slice. Any thunks you write are done as usual, and it's up to you if and how you test those. Out of curiosity, who have you been talking to, and where are these discussions taking place? |
The reducers are easy to test, and are well-documented. The more 'grey' areas arrive when building out tests for components that subscribe to selectors and implement various Redux-hooks, as well as asynchronous actions. I have found the initial setup and stubbing to be the biggest headache through trial and error. While I definitely learned a lot in the process, it would be helpful to have a playbook of sorts to jump off from. And this has been brought up in discussions with coworkers, friends who have launched their own projects with RSK, and React meetups. |
There really isn't anything specific about RSK in relation to any of that, though. That said, I'd be fine with trying to flesh out the core docs page on testing as part of the docs revamp we're starting (see reduxjs/redux#3596 and https://github.com/reduxjs/redux/milestone/5 ). I also have links to some existing articles on testing Redux here: https://github.com/markerikson/react-redux-links/blob/master/react-redux-testing.md |
Hey @markerikson! I am teaching redux-toolkit in a bootcamp and my students can definitely use some real-world examples if it's available. |
I'm trying to figure out how to architect my project and am not sure how all the parts and pieces here fit together.
The text was updated successfully, but these errors were encountered: