Skip to content

react hooks array not updating #15090

@yahengqi

Description

@yahengqi

const mappingDashboardeColor: any = [];
const [mappingPicker, setMappingPicker] = useState(mappingDashboardeColor);

function handleColorPickerValueChange(index: number, colorPickerValue: any) {
_.map(mappingPicker, (n, k) => {
if (parseInt(k) === index) {
mappingPicker[k].colorPicker = colorPickerValue.label;
}
})
setMappingPicker(mappingPicker);

}

Write like this without updating

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions