#Persist Filter State in React Application Using localStorage
16 messages · Page 1 of 1 (latest)
@distant salmon no , it doesnt
@night gulch Looks like you've got an infinite render loop somewhere, where some effect causes a state change that causes the same effect to fire again.
I don't think that just writing to local storage should cause that - that shouldn't cause a rerender, so it may be somewhere else in your codebase.
Switching to the non-minified version of React would probably help a lot for debugging.
when i search smth that doesnt exist , it shows all data instead of showing : 'no rows' i dont understand why i have this bug when i have conditonally rendered that is filterData == 0 , display no rows🤔 {filteredData.length === 0 && searchTerm && (
<Typography variant="h6" className="no-data-message">
No results found for "{searchTerm}"
</Typography>
)}
Doesn't look like you're conditionally rendering? object.config.message is the condition that shows the "no-data-message"
Also, filteredData.length > 0 || searchTerm ? filteredData : data looks like it falls back to data when filteredData is empty.
Maybe you can reproduce it on a code sandbox? Hard to debug things just looking at unformatted code
yea just 1 moment pls
Sorry, I meant https://codesandbox.io/ something that's runnable in a browser - I'm not really looking to download a zip and setup a project from that
Doesn't have to be the real project, just has to reproduce the error
(Also, trying to simplify and reproduce a problem often solves it)
Looks like you have to hit share; getting "sandbox not found, you don't have permission to access this"