-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to update items live? #91
Comments
I'm not sure what you mean. Can you provide a real world example? |
So basically I want to see my items in the Masonry style, I wanna be able to click on them to open a modal, update the data associated with the item, and the changes be automatically be updated in the Masonry as well. I hope that clears it up. |
This is all achievable by coding the same way you'd always code this with React. When your data updates, the items rendered in the masonry component will update. You can add items any time you want, including when a button is clicked. Just make sure you use the |
Looking at the docs, this is for the Here is a working example, where I am trying to add a cat but the browser just freezes: Why am I using |
Hey, thank you so much! |
I think that's it. Basically you don't need the infinite loader when you've got a button doing the work for you :) |
The reason I had the infinite loader, was because I don't know how much data there will be, a user can create new ones constantly. |
I continue to work with it and realised I now got an issue when I delete an item.
Here is the Sandbox again: https://codesandbox.io/s/react-masonic-live-updates-pijwf?file=/src/FileGrid.js Console Warning
|
@jaredLunde Thank you! I added deps to my positioner and now everything works great. |
Happy to help! |
I know that the items are saved in a cache, so if I add a new item to the list or update something, move away and back to it, the update is there. But I need it to update it live. I looked at the documentation but wasn't able to find anything that tells me how to update something live.
The closest thing I found was the example with a react-router, where
useEffect
is run when a variable changes and setting the items anew. I have tried by having thedata.length
be the dependency, but that didn't work.Is there a possibility where this works and I just did not see it?
The text was updated successfully, but these errors were encountered: