Add react keys to remove warnings

This commit is contained in:
Sam Nolan 2022-05-13 15:40:52 +00:00
parent 937458cd05
commit 006204f1ac
2 changed files with 7 additions and 6 deletions

View File

@ -141,10 +141,10 @@ export const FunctionChart: React.FC<FunctionChartProps> = ({
/>
{showChart}
{_.entries(groupedErrors).map(([errorName, errorPoints]) => (
<ErrorBox heading={errorName}>
<ErrorBox key={errorName} heading={errorName}>
Values:{" "}
{errorPoints
.map((r) => <NumberShower number={r.x} />)
.map((r, i) => <NumberShower key={i} number={r.x} />)
.reduce((a, b) => (
<>
{a}, {b}

View File

@ -148,8 +148,9 @@ const SquiggleItem: React.FC<SquiggleItemProps> = ({
case "array":
return (
<VariableBox heading="Array" showTypes={showTypes}>
{expression.value.map((r) => (
{expression.value.map((r, i) => (
<SquiggleItem
key={i}
expression={r}
width={width !== undefined ? width - 20 : width}
height={50}
@ -166,7 +167,7 @@ const SquiggleItem: React.FC<SquiggleItemProps> = ({
return (
<VariableBox heading="Record" showTypes={showTypes}>
{Object.entries(expression.value).map(([key, r]) => (
<>
<div key={key}>
<RecordKeyHeader>{key}</RecordKeyHeader>
<SquiggleItem
expression={r}
@ -178,14 +179,14 @@ const SquiggleItem: React.FC<SquiggleItemProps> = ({
chartSettings={chartSettings}
environment={environment}
/>
</>
</div>
))}
</VariableBox>
);
case "arraystring":
return (
<VariableBox heading="Array String" showTypes={showTypes}>
{expression.value.map((r) => `"${r}"`)}
{expression.value.map((r) => `"${r}"`).join(", ")}
</VariableBox>
);
case "lambda":