import React from "react"; import {LevelUI} from "./warnings"; import {useShopStore} from "./shop_store"; import {useRenderCount} from "@uidotdev/usehooks"; const compareArrays = (a, b) => a.length === b.length && a.every((element, index) => element.id === b[index].id); export function CrateWarnings({crate_index}) { const renderCount = useRenderCount(); const crate_warnings = useShopStore(state => (state.crates[crate_index].warnings), compareArrays) console.log("CrateWarnings renders: ", renderCount) // TODO UI/colors return (
{crate_warnings.map((rule, index) => (

{rule.message}

))}
) }