MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / toggleSavedComponent

Function toggleSavedComponent

src/utils/favorites.js:48–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46};
47
48export const toggleSavedComponent = key => {
49 const list = read();
50 if (list.includes(key)) {
51 const next = list.filter(item => item !== key);
52 write(next);
53 return { saved: false, list: next };
54 }
55 const next = [...list, key];
56 write(next);
57 return { saved: true, list: next };
58};
59
60export default {
61 getSavedComponents,

Callers 2

cellRendererFunction · 0.90
toggleFavoriteFunction · 0.90

Calls 2

readFunction · 0.70
writeFunction · 0.70

Tested by

no test coverage detected