This file contains 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 from 'react'; | |
import shallowEqual from 'shallowequal'; | |
function customizer(valueA, valueB, propName) { | |
if (propName === 'style') { | |
return shallowEqual(valueA, valueB); | |
} | |
return undefined; | |
} |
This file contains 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 { createStore as basicCreateStore } from 'redux'; | |
export const skipSameStateEnhancer = createStore => ( | |
reducer, | |
initialState, | |
enhancer, | |
) => { | |
const store = createStore(reducer, initialState, enhancer); | |
// Create an in-between store so that we can skip subscription updates where nothing changed. |
This file contains 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
// Sometimes you want to run parent effects before those of the children. E.g. when setting | |
// something up or binding document event listeners. By passing the effect to the first child it | |
// will run before any effects by later children. | |
export function Effect({ effect }) { | |
useEffect(() => effect?.(), [effect]); | |
return null; | |
} | |
// |