This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const useToggleableGrid = ({ items, minItemWidth, maxItemWidth }) => { | |
| const containerRef = useRef(); | |
| const [itemsConfig, setCardsConfig] = useState({ | |
| originalItems: items, | |
| items: items, | |
| openItemId: null | |
| }); | |
| const { width: containerWidth } = useElementDimensions(containerRef); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const newPromises = () => { | |
| const newDataArray = mapping.reduce(async(acc, data) => { | |
| const accumulator = await acc.resolve(); | |
| const newThings = await createNewData(data); | |
| return Promise.resolve([...accumulator, ...newThings]) | |
| }, Promise.resolve([])); | |
| return newDataArray; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useReuse } from 'reusable'; | |
| import { persisUnit } from 'src/units/persist.unit'; | |
| const PersistGate = ({ children, loading = null }) => { | |
| const { persistedState } = useReuse(persisUnit); | |
| return !persistedState ? loading : children; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { forwardRef, createRef } from 'react'; | |
| const Child = forwardRef((props, ref = noop) => ( | |
| <div>Child</div> | |
| )) | |
| class Parent extends React.Component { | |
| constructor(props) { | |
| super(props); | |