The Wayback Machine - https://web.archive.org/web/20220515000820/https://github.com/dotnet/aspnetcore/issues/40540
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

Rewrite React template as function component with hooks #40540

Open
1 task done
vanillajonathan opened this issue Mar 4, 2022 · 4 comments · May be fixed by dotnet/spa-templates#41
Open
1 task done

Rewrite React template as function component with hooks #40540

vanillajonathan opened this issue Mar 4, 2022 · 4 comments · May be fixed by dotnet/spa-templates#41
Labels
area-mvc feature-spa good first issue help wanted
Milestone

Comments

@vanillajonathan
Copy link
Contributor

@vanillajonathan vanillajonathan commented Mar 4, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

The React community has largely moved on from the old class-based components and now favors function components with hooks.

Describe the solution you'd like

Rewrite the Counter.js, FetchData.js, Home.js, Layout.js, NavMenu.js and App.js files to use a function component with hooks.

Additional context

Use the useState hook.

@vanillajonathan vanillajonathan changed the title Rewrite FetchData.js as function component with hooks Rewrite React teomplate as function component with hooks Mar 4, 2022
@javiercn
Copy link
Member

@javiercn javiercn commented Mar 4, 2022

@vanillajonathan thanks for contacting us.

This is not something we plan to do in the near future. Code in the templates is a starting point and updating them is costly without a clear benefit on using a different pattern.

If you have a concrete proposal and we think its reasonable, we might be open to accepting a PR

@javiercn javiercn added area-mvc feature-spa help wanted good first issue labels Mar 4, 2022
@javiercn javiercn added this to the Backlog milestone Mar 4, 2022
@msftbot
Copy link
Contributor

@msftbot msftbot bot commented Mar 4, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

Vadimyan pushed a commit to Vadimyan/spa-templates that referenced this issue Mar 9, 2022
1. Rewrite React template as function component with hooks
2. Bringing imports in react template to a unified style
3. Bringing indents for js files in react template to a unified style
@Vadimyan
Copy link

@Vadimyan Vadimyan commented Mar 14, 2022

Hi! I've prepared a PR dotnet/spa-templates#41 with fully refactored react template. Now it use functional components with react hooks. Also I brought the code in template to a single code style.

But now I think that it can be a good time to rewrite this template to typescript. It can help beginners to start learning aspnet with TS from the template, and in the case of new projects, it'll allow developers not to rewrite existing code to TS.

Is it worth creating a separate issue about it or could it be part of the discussion of the current one?

@vanillajonathan vanillajonathan changed the title Rewrite React teomplate as function component with hooks Rewrite React template as function component with hooks Mar 15, 2022
@vanillajonathan
Copy link
Contributor Author

@vanillajonathan vanillajonathan commented Mar 15, 2022

Good job @Vadimyan!
I think TypeScript is a separate issue. Nonetheless interesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc feature-spa good first issue help wanted
3 participants