Skip to content

Commit

Permalink
React18: children prop must be explicitly declared
Browse files Browse the repository at this point in the history
  • Loading branch information
gjoseph committed Nov 21, 2024
1 parent 7f36da4 commit e069ab7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tichu-clients/packages/tichu-web/src/components/CardSet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ const withPosition =
const PositionedCardView = withPosition(CardView);
const PositionedCardBack = withPosition(CardBack);

const CardSetContainer: FC<{ cardSize?: CardSize }> = ({
cardSize = "regular",
children,
}) => {
const CardSetContainer: FC<{
cardSize?: CardSize;
children?: React.ReactNode;
}> = ({ cardSize = "regular", children }) => {
const classNames = classes(
styles.cardSet,
cardSize === "small" ? styles.smallSet : styles.regularSet
Expand Down
4 changes: 1 addition & 3 deletions tichu-clients/packages/tichu-web/src/components/CardView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import styles from "./Card.module.css";
export type OnCardClick = (card: Card) => void;
export type CardSize = "small" | "regular";

// no children elements in CardView
interface CardViewProps {
card: Card;
selected: boolean; // TODO wonder if selected is anything than a css class that could be set by parent
Expand Down Expand Up @@ -51,9 +52,6 @@ const symbolFor = (card: Card): string => {
}
};

/**
* I don't know how to prevent children elements - does it matter?
*/
export const CardView: FC<CardViewProps> = ({
card,
selected,
Expand Down
2 changes: 1 addition & 1 deletion tichu-clients/packages/tichu-web/src/components/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { OtherPlayer } from "./OtherPlayer";
/**
* Represents the player at the table
*/
const Player: FC = (props) => {
const Player: FC<{ children?: React.ReactNode }> = (props) => {
return (
<div className={styles.player}>
This is me
Expand Down

0 comments on commit e069ab7

Please sign in to comment.