Northeastern-Electric-Racing / Northeastern-Electric-Racing/FinishLine

[Frontend] - Remove React.FC

Open
#800 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

front-end spike technical improvement
Dominant language
TypeScript
Stars
36
Forks
9
Avg merge
4d 21h
Merged PRs (30d)
11

Description

Spike Type

Technical

Goal

Stop using React.FC for components. Instead, use

const App = ({ message }: AppProps) => <div>{message}</div>;
const App = ({ message }: AppProps): JSX.Element => <div>{message}</div>;
Reason for Spike

Amongst other reasons, React.FC provides an implicit definition of children, so components will accept even if they are not supposed to.

For example, in AppMain.tsx, there are no type errors with this:

const AppMain: React.FC = () => {
  return (
	{/* here */}
	<AppPublic>
		<h1>Children!</h1>
	</AppPublic>
  );
};

even though AppPublic does not accept children (const AppPublic: React.FC = () => { ...)

It's been removed from create react app and replaced with function App() { ...

Additional notes

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by searching the repository for React.FC and inspect the AppMain.tsx and AppPublic examples mentioned in the issue. Replace the usages with the function forms described in the goal, preserving each component's props, and consider the work complete when no React.FC usages remain and the affected TypeScript code still type-checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.