Skip to content

Commit

Permalink
Refactor component function declarations to arrow
Browse files Browse the repository at this point in the history
functions
  • Loading branch information
samanthathompson52 committed Dec 12, 2023
1 parent 9d62e53 commit ca19031
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion client/src/components/Answer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {useState} from 'react';
import { Player } from './Player';

function Answer({sendJsonMessage, prompt, players}: {sendJsonMessage: any, prompt: string, players: Player[]}) {
const Answer = ({sendJsonMessage, prompt, players}: {sendJsonMessage: any, prompt: string, players: Player[]}) => {

const [answer, setAnswer] = useState('');

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Lobby from "./Lobby";
import { Player } from "./Player";
import PlayerIcon from "./PlayerIcon";

function Game({sendJsonMessage, lastMessageJson}: {sendJsonMessage: any, lastMessageJson: any}) {
const Game = ({sendJsonMessage, lastMessageJson}: {sendJsonMessage: any, lastMessageJson: any}) => {

let round:number = -1;
let players:Player[] = [];
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Guess.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {useState} from 'react';
import { Player } from './Player';

function Guess({sendJsonMessage, players, answers, currentPlayerId, playerId, prompt}: {sendJsonMessage: any, players: Player[], answers: string[], currentPlayerId: string, playerId: string, prompt: string}) {
const Guess = ({sendJsonMessage, players, answers, currentPlayerId, playerId, prompt}: {sendJsonMessage: any, players: Player[], answers: string[], currentPlayerId: string, playerId: string, prompt: string}) => {

const [guessPlayer, setGuessPlayer] = useState('');
const [guessAnswer, setGuessAnswer] = useState('');
Expand Down
3 changes: 1 addition & 2 deletions client/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Logo from '../images/Logo.png'

const Header = ({roomCode}: {roomCode:string}) => {

const roomCodeUpper = roomCode.toUpperCase();
const roomCodeUpper = roomCode.toUpperCase();

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Join.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useState} from 'react';

function Join({sendJsonMessage, roomCode, setRoomCode}: {sendJsonMessage: any, roomCode: any, setRoomCode: any}) {
const Join = ({sendJsonMessage, roomCode, setRoomCode}: {sendJsonMessage: any, roomCode: any, setRoomCode: any}) => {

const [username, setUsername] = useState('');

Expand Down
5 changes: 1 addition & 4 deletions client/src/components/PlayerIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import {useState} from 'react';
import { Player } from './Player';

export const iconMap:any = {
bear: "bear.svg",
chicken: "chicken.svg",
Expand All @@ -18,7 +15,7 @@ export const iconMap:any = {
cow: "cow.svg"
}

function PlayerIcon({iconName}: {iconName: string}) {
const PlayerIcon = ({iconName}: {iconName: string}) => {
if (!iconMap[iconName]) {
return <></>
}
Expand Down

0 comments on commit ca19031

Please sign in to comment.