Skip to content

Tag: reactjs

Order an array of objects based in other array values

Lets say I have an array of products: and I have another, smaller array where I store the order of the products on my page: And I want my Products array in such a way they are ordered like the orderItems array defines, like so: and I want the products who do not have a corresponding orderItem to be at