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

Add redux toolkit example with Typescript #23052

Closed
wants to merge 3 commits into from

Conversation

Mokshit06
Copy link
Contributor

This is the typescript version of the other Pull Request (#23047) which I created in which I had simplified the redux toolkit example.

The code structure is identical to the official redux typescript template

@ijjk ijjk added the examples Issue/PR related to examples label Mar 14, 2021
Copy link
Member

@leerob leerob left a comment

Choose a reason for hiding this comment

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

My personal opinion: there's barely any TypeScript code here to make it different from the other example. Should we just stick with that one which was just merged?

@Mokshit06
Copy link
Contributor Author

Hey, I think that there should be a separate example with typescript because it has types like RootState, AppDispatch, AppThunk and typed hooks for useDispatch and useSelctor already configured, so it would reduce some friction if someone wanted to have typescript enabled.

@leerob
Copy link
Member

leerob commented Mar 17, 2021

@Mokshit06 Let’s instead add that small bit to the readme of the other example then? A short typescript section with that code snippet.

There’s been a couple instances where we had duplicate examples and one was updated and the other wasn’t, so if the code isn’t that different for typescript, I try to avoid it.

@Mokshit06
Copy link
Contributor Author

Mokshit06 commented Mar 17, 2021

@leerob Since the file structure of this example is identical to the one in the redux toolkit template, should we just link the official documentation on setting up redux toolkit and react-redux with typescript in the readme? It lists all the steps in great detail and works with the Next.js setup.

@leerob
Copy link
Member

leerob commented Mar 17, 2021

Yep I like that idea 👍

@Mokshit06
Copy link
Contributor Author

Mokshit06 commented Mar 17, 2021

Does this look good?

Typescript Setup

  • If you haven't already added typescript to your project, follow the instructions given here to add Typescript to your Next.js project. If you are new to typescript, go through this lesson on Typescript with Next.js.

  • Follow the instructions given on the Redux Toolkit documentation to set up Redux Toolkit and React-Redux with Typescript.

@leerob
Copy link
Member

leerob commented Mar 17, 2021

@Mokshit06 👍

@Mokshit06
Copy link
Contributor Author

@leerob Should I create a new Pull Request with these changes or should I add them in this one and delete the typescript example?

@leerob
Copy link
Member

leerob commented Mar 17, 2021

Let's just make a new PR. Thank you so much! 🙏

@leerob leerob closed this Mar 17, 2021
@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants