Next.js Discord

Discord Forum

Form issue | App for football lineups - Game Soccer Clash

Unanswered
Great golden digger wasp posted this in #help-forum
Open in Discord
Great golden digger waspOP
Hi, I need some help.

We are playing a game and we want to watch stats from our games.

The thing is that I need to somehow use the react hook form to differentiate which player is in each line: one player can bid in multiple lines and now when I want to add a player to the stats, either his score is duplicated in other lines (same player but different line) or the line is duplicated directly in all lines (line 1 is the same in all lines).

Another thing is that when I load the whole thing, in the menu for adding new players I also have 2 default players for the line (each line has two players assigned, but anyone can bid). I'll fix this myself somehow, but you can help too.

Error when I wanted to separate them.
Type 'players.${number}.${number}.name' is not assignable to type '"players" | players.${number} | players.${number}.id | players.${number}.name | players.${number}.score | players.${number}.line'.ts(2322)
controller.d.ts(20, 5): The expected type comes from property 'name' which is declared here on type 'IntrinsicAttributes & { render: ({ field, fieldState, formState, }: { field: ControllerRenderProps<{ players: [{ id: string; name: string; score: number; line: number; }, ...{ id: string; name: string; score: number; line: number; }[]]; }, "players" | ... 4 more ... | players.${number}.line>; fieldState: Controlle...'
⚠ Error (TS2322)  | 
Type 
 is not assignable to type:
.
(property) name: "players" | players.${number} | players.${number}.id | players.${number}.name | players.${number}.score | players.${number}.line


I am using shadcn and nextjs

Link: https://github.com/krouskystepan/football-lineup
Game stats table:

0 Replies