muuri-react | The layout engine for React | Grid library
kandi X-RAY | muuri-react Summary
kandi X-RAY | muuri-react Summary
Responsive, sortable, filterable and draggable grid layouts with React.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of muuri-react
muuri-react Key Features
muuri-react Examples and Code Snippets
Community Discussions
Trending Discussions on muuri-react
QUESTION
I am passing a list of objects to muuri-react
to display in a draggable grid layout and it works fine when I pass an explicitly defined list of objects, but when I use a redux selector to get the data it breaks even though it's the same data.
Here is an example that reproduces this: https://codesandbox.io/s/agitated-montalcini-rbdso?file=/src/components/pages/Notes.js
I render two Muuri grids one with with notes1
and one with notes2
which are identical objects, but somehow notes1
works fine and notes2
doesn't render properly (not draggable) and causes the error Invariant failed: The item has not been setted yet
if you try navigating to another tab like Reminders. I check that notes1
and notes2
are equal with lodash console log.
ANSWER
Answered 2021-Sep-03 at 08:00If you log notes2
, you will see that it changes from the length of 0 (start request), to the length of 3 (fully requested)
I see that the issue is due to the dynamic aspect of notes2
, while it seems that the murri lib will load well for the static one (notes1
)
So a quick fix could be to make sure to load MurriGrid after notes2
is fully requested, so it will avoid first time load for the init one (length of 0) then rerender to fully-loaded one (length of 3) - which caused unexpected behavior
QUESTION
I'm working with react and I'm using a library called muuri-react. In this case I'm using it to filter elements by a property named category (see the link of the code). this category receive a value. In this case I'm filter the elements by technologies for example one category named "javascript" other react, other node etc etc. I'm following the oficial documentation but is no working.
...ANSWER
Answered 2020-Sep-16 at 11:32/* React */
import React, { useState, useCallback } from "react";
import "./styles.css";
import { MuuriComponent } from "muuri-react";
// App.
const App = () => {
// Items state.`enter code here`
const [projects] = useState([
{
key: 1,
category: "javascript",
ProjectName: "contador"
},
{
key: 2,
category: "javascript",
ProjectName: "contador"
},
{
key: 3,
category: "javascript",
ProjectName: "contador"
},
{
key: 4,
category: "react",
ProjectName: "contador"
},
{
key: 5,
category: "react",
ProjectName: "contador"
},
{
key: 6,
category: "react",
ProjectName: "contador"
},
{
key: 7,
category: "react",
ProjectName: "contador"
},
{
key: 8,
category: "react",
ProjectName: "contador"
},
{
key: 9,
category: "node",
ProjectName: "contador"
},
{
key: 10,
category: "node",
ProjectName: "contador"
},
{
key: 11,
category: "javascript",
ProjectName: "contador"
}
]);
// Filter state.
const [filter, setFilter] = useState({
value: "all"
});
// Filter method.
const filterFunction = useCallback(
function (data) {
var isFilterMatch =
filter.value === "all" ? true : data.category === filter.value;
return isFilterMatch;
},
[filter.value]
);
// Children.
const children = projects.map(({ key, category }) => (
));
return (
{/* Header */}
setFilter({ ...filter, value: e.target.value })}
/>
({ category })}
filter={filterFunction}
>
{children}
);
};
// Item component.
const Item = ({ category }) => {
return (
{category}
);
};
const Select = ({ values, onChange }) => {
return (
{values.map((value, i) => (
{value}
))}
);
};
export default App;
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install muuri-react
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page