I'm creating an app and I need to render a form element multiple times with some of the variable names changed around. Unfortunately, I'm having some issues where not all of the code is being returned from the component. I've taken out some of the variable declarations to make this easier to read.
Primary Component
export default function StrengthLog() {
return (
<Container id="strengthContainer">
<SelectMovements />
<Form>
{
movement.map(movement => {
const checked = movement[1].triggered
if (checked){
return <StrengthForm props={movement}/>
}
})
}
<Button content='submit'>Submit</Button>
</Form>
</Container>
)
}
Component being returned
export default function StrengthForm({props}) {
return (
<div>
<h1>Hello!</h1>
{
props[1].triggered
? (
setsArray.map(item => {
return <Group widths='equal'>
<Select fluid label='Reps' placeholder='Select Reps' options={repOptions} name={`${liftVarName}-rep-1`}/>
<Input fluid placeholder='Enter Weight' label='Weight' name={`${liftVarName}-weight-1`}/>
<Button className="addSet">+</Button>
<Button className="deleteSet">x</Button>
</Group>
})
)
: console.log('Thing')
}
</div>
)
}
What's happening is that it's returning the <h1> of StrengthForm but it's not returning the other information contained within the curly braces.
props[1].triggeredevaluate to true ?console.log(props[1].triggered)and it does return astruesetsArrayvariable? from where is it coming from?const setsArray = new Array(props[1].sets)whereprops[1].setsis always set to 3 for now.