Skip to content

refactor: convert class components to function components#60

Merged
mjdavidson merged 1 commit intomasterfrom
mattd/explore-classes-to-functions
May 7, 2026
Merged

refactor: convert class components to function components#60
mjdavidson merged 1 commit intomasterfrom
mattd/explore-classes-to-functions

Conversation

@mjdavidson
Copy link
Copy Markdown
Contributor

All 8 React.Component classes → function components. None used lifecycle methods, refs, or setState callbacks, so the conversion is mechanical:

  • 5 with no state: drop class extends React.Component { override render() { return X } } to () => X
  • 3 with state (pages/app/{login,settings,sso}.tsx): replace constructor-set { success, message } with two useState hooks each
  • pages/index.tsx's renderHero/Sections/Cta/Footer methods become top-level helper consts (they share no scope with the page)

Side wins: drops every override modifier, drops most import React from 'react's, all exports are now this-free.

Replaces all 8 React.Component class definitions with function
components. Trivial since none used lifecycle methods, refs, or
setState callbacks.

- components/Alert.tsx, LoginWithEmail.tsx, LoginWithSSO.tsx
- pages/app/index.tsx (no state)
- pages/index.tsx (no state — split renderHero/Sections/Cta/Footer
  into top-level helper consts since they share no scope)
- pages/app/{login,settings,sso}.tsx (state: success + message,
  replaced with two useState hooks each)

Side wins:
- Drops every `override` modifier (no more class methods).
- Drops most `import React from 'react'`s.
- All exported functions are now `this`-free; oxlint
  no-this-in-exported-function would flag any future regression.

Verified: typecheck (strict), lint (0 warnings), format, build
all pass.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
explore Ready Ready Preview, Comment May 7, 2026 10:12pm

Request Review

@mjdavidson mjdavidson merged commit 2782f47 into master May 7, 2026
9 checks passed
@mjdavidson mjdavidson deleted the mattd/explore-classes-to-functions branch May 7, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant