Skip to content

Break up app.js #168

Description

@didoesdigital

The app.js file is huge, disorganised, unformatted, has 1 giant app state, is a class component, and lacks types. I want to make app.js and changing Typey Type more manageable.

Background

Typey Type started out as a single component, single page (no routes) app about 7 years ago before React hooks existed. I've been progressively breaking down components into smaller, more manageable parts, with more folder structure, and updating them to TypeScript with a preference for function components so I can use hooks (see examples: #144, #145, #146, #147, #148, #149, #150). But app.js is so large, tangled, and unwieldy that it is difficult to break up.

Goals

  • Having 1 giant app state makes it difficult to make changes and every change to state causes the entire app to re-render so having better state management would make it possible to reduce unnecessary and sometimes expensive re-renders, reduce prop drilling, and make it easier to make changes. I expect that would look like using a React Context provider for each user setting and for other small groups of app state.
  • If App and everything in app.js was using function components, it would be easier to use hooks in more places, which are extremely helpful.
  • If app.js were smaller, it would be easier to add types and convert components to TypeScript to make changes easier and more maintainable.
  • Smaller, single-purpose files would be easier to read, understand, and update.
  • Organised folders and files would make it easier to find relevant code.
  • Breaking down a component to its own file in 1 commit and formatting the component in a separate commit would reduce noise in commits and make code consistently formatted and readable.

Approach

While I prefer structured refactoring with small, isolated, always-working commits, I may be reaching the limits of what's left in app.js that can be broken down a bit at a time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions