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, { useEffect, useState, useCallback } from "react"; | |
import { useResizeDetector } from "react-resize-detector"; | |
const AppGamma = () => { | |
const [widthA, setWidthA] = useState<number>(800); | |
const onResize = useCallback(() => { | |
// on resize logic | |
}, []); | |
const { width, ref } = useResizeDetector({ |
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, { useEffect, useRef, useState } from "react"; | |
const AppBeta = () => { | |
const [width, setWidth] = useState<number>(window.innerWidth); | |
const [widgetBWidth, setWidgetBWidth] = useState<number | undefined>(); | |
const widgetBContainer = useRef<HTMLDivElement>(null); | |
const updateWidth = () => { | |
setWidth(window.innerWidth); |
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 mainReducer = combineReducers({a, b, c}); | |
const secondReducer = function(state, action) { | |
switch(action.type) { | |
case SOME_ACTION: | |
return someSpecificReducer(state.a, state.c); | |
default: return state; | |
} | |
}; |