dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.37k stars 9.99k forks source link

Convert React+Redux template to use official Redux Toolkit package #16907

Closed markerikson closed 3 years ago

markerikson commented 4 years ago

Hi, I'm a Redux maintainer.

The React+Redux template currently uses a "hand-written" approach for the Redux logic, such as this snippet:

https://github.com/aspnet/AspNetCore/blob/025476f31ee229b8e65e400d29c5606d992f023c/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/src/store/Counter.ts#L15-L48

We now have an official addon package called Redux Toolkit, which includes utilities to simplify several common Redux use cases, including store setup, defining reducers, immutable update logic, and even creating entire "slices" of state at once without writing an action types or action creators by hand.

It's now our recommended default approach for writing Redux logic.

RTK is already written in TypeScript, and you can see examples of using it with TS in the Advanced Tutorial docs page.

I'd like to see the template converted to use RTK instead of hand-written action creators and reducers.

Let me know if you have any questions!

javiercn commented 4 years ago

@markerikson thanks for contacting us.

@SteveSandersonMS do you have thoughts about this?

We will likely not tackle this ourselves for the time being, but if we agree that this is the right path, we might consider accepting a PR with the change/update.

SteveSandersonMS commented 4 years ago

@markerikson Really glad you've got in touch! We've been coming to the realization that for these SPA framework templates, they would be much better maintained if they were owned not by the ASP.NET Core team but rather by representatives from each of the relevant SPA framework communities. The scenario you're giving here of Redux changing its recommendation to use the new RSK is a prime example of the reasoning - the small ASP.NET Core team can't respond to all these external changes as fast or as accurately as the Redux community could.

Rather than us significantly changing the existing template, we'd be more likely to offer support to the open-source community to build a new and better replacement, and then make that our official recommendation for ASP.NET Core developers to use.

Do you have any thoughts on anyone you know in the Redux world who would be interested in taking charge over an ASP.NET Core + Redux template? We'd be able to help them get started (e.g., with an initial project structure and info on how to publish), plus we have the resources to contribute PRs whenever the ASP.NET Core aspects of the template needs to be updated in the future. Do you think this is something the Redux team themselves would want to own, or is there any other person you would recommend?

cc @danroth27 (our PM for this)

markerikson commented 4 years ago

The Redux core team is just @timdorr and myself, and we don't have the bandwidth to maintain various external templates (really quite similar to your own situation :) ).

But yeah, I can try publicizing the issue and see if anyone might want to help out.

markerikson commented 4 years ago

Tweeted out that question:

https://twitter.com/acemarke/status/1192871279801577472

markerikson commented 4 years ago

Hi, wanted to follow up on this.

I'd still really like to see any template code converted to use Redux Toolkit by default, as we now do in our official Redux templates for Create-React-App:

https://github.com/reduxjs/cra-template-redux

https://github.com/reduxjs/cra-template-redux-typescript

In fact, is there maybe some way to actually have ASP.net project setup use the CRA template automatically?

SteveSandersonMS commented 4 years ago

cc @danroth27

danroth27 commented 4 years ago

Hi @markerikson. We are having various discussions about how to maintain the various ASP.NET Core SPA templates going forward. We certainly would like them to stay up to date with the latest best practices. We'll be digging deeper into how to achieve that for .NET 5. We're focused on other priorities right now, but we should be in a better place to engage on this issue in about a month (basically after the upcoming Microsoft BUILD conference).

markerikson commented 4 years ago

Sure. Just ping me when you've got time to discuss this further.

markerikson commented 4 years ago

Hey, just wanted to follow up on this. Any further thoughts?

danroth27 commented 4 years ago

Hi @markerikson. We've made some progress on deciding how we want to maintain the SPA templates going forward. We should have more details to share in the next few weeks.

markerikson commented 4 years ago

bump

ghost commented 3 years ago

Thank you for contacting us. Due to a lack of activity on this discussion issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue.

This issue will be locked after 30 more days of inactivity. If you still wish to discuss this subject after then, please create a new issue!

SteveSandersonMS commented 3 years ago

@markerikson Sorry that our bot has rudely closed this issue even though it was not addressed. I'm reopening it.

It's worth saying that, at this point, the team is working towards producing a bigger update in our SPA template strategy to make what we have more maintainable for the long term. So we most likely wouldn't attempt to do what this issue suggests in the short term, as the people working in this area are more focused on the bigger shape of the SPA template support.

markerikson commented 3 years ago

haha, no worries :) I understand having other stuff to focus on. Please feel free to ping me whenever you do have some more concrete ideas to discuss!

ghost commented 3 years ago

Thank you for contacting us. Due to a lack of activity on this discussion issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue.

This issue will be locked after 30 more days of inactivity. If you still wish to discuss this subject after then, please create a new issue!

markerikson commented 3 years ago

ping

Still interested in hearing updates on any plans here.

ghost commented 3 years ago

Thank you for contacting us. Due to a lack of activity on this discussion issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue.

This issue will be locked after 30 more days of inactivity. If you still wish to discuss this subject after then, please create a new issue!

SteveSandersonMS commented 3 years ago

@danroth27 Do you want to keep fighting the bot and reopen this again?

Meligy commented 3 years ago

I heard there are many changes in the templates in .NET 6 (currently in preview). Anyone knows if this is part of them?

Meligy commented 3 years ago

I don't even see Redux anymore!

https://github.com/dotnet/aspnetcore/tree/main/src/ProjectTemplates/Web.Spa.ProjectTemplates/content

https://github.com/dotnet/aspnetcore/tree/main/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp

ghost commented 3 years ago

Thank you for contacting us. Due to a lack of activity on this discussion issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue.

This issue will be locked after 30 more days of inactivity. If you still wish to discuss this subject after then, please create a new issue!

Meligy commented 3 years ago

This ticket should not have been closed IMO. There was no response from Microsoft.

BTW, the SPA code has now moved to a submodule in another repository (which has no issue tracker, so this issue is still valid):

https://github.com/dotnet/spa-templates/

For React:

https://github.com/dotnet/spa-templates/tree/main/src/content/React-CSharp/ClientApp/

Still no Readux in there.

javiercn commented 3 years ago

@Meligy We did announce that we are not continuing support for the react redux template moving forward.

You can read the announcement here

Meligy commented 3 years ago

Oh, sorry for missing this one. I guess this story can remain closed then :/