Skip to content

Instantly share code, notes, and snippets.

View atharva-bhange's full-sized avatar
👊
Focusing

Atharva Nitin Bhange atharva-bhange

👊
Focusing
View GitHub Profile
const App = () => {
const parentRef = useRef<HTMLDivElement | null>(null);
const firstRef = useRef<HTMLDivElement | null>(null);
const secondRef = useRef<HTMLDivElement | null>(null);
const resizerRef = useRef<HTMLDivElement | null>(null);
const mouseXCor = useRef(0);
const firstWidth = useRef(0);
const shouldDrag = useRef(false);
const onMouseDown = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
@atharva-bhange
atharva-bhange / App.tsx
Created March 4, 2021 07:11
Calling Async action creators without using thunk or saga
// Calling a async action without using thunk or saga in the component itself
function mapDispatchToProps(dispatch: Dispatch<MyAction>): Pick<Props,'getPosts'> {
return: {
getPosts: async () => {return dispatch( getAction( await fetch('/stuff') ) );},
};
}