Skip to content

Instantly share code, notes, and snippets.

View gargroh's full-sized avatar

Rohit Garg gargroh

  • Hyderabad, India
View GitHub Profile
@gargroh
gargroh / index.js
Last active January 30, 2019 14:30
#!/usr/bin/env node
console.log('HELLO');
import React from 'react';
import PropTypes from 'prop-types';
import {
ensurePluginOrder,
getFirstDefined,
makeHeaderGroups,
applyPropHooks,
mergeProps,
flexRender
@gargroh
gargroh / useCellRangeSelection.js
Created December 12, 2019 11:26
[React Table v7] [useCellRangeSelection] Excel like cell range selection in react table
import React from 'react';
import {
actions,
makePropGetter,
ensurePluginOrder,
functionalUpdate,
useConsumeHookGetter,
useGetLatest
} from '../../react-table/utils';
import React from 'react';
export default function useResizer() {
let dragging = React.useRef(false);
let startPos = React.useRef(0);
const [delta, setDelta] = React.useState(0);
const [dragEnded, setDragEnded] = React.useState(false);
React.useEffect(() => {
import React from 'react';
import { actions } from '../../react-table/utils';
// Actions
actions.forceUpdate = 'forceUpdate';
export const useControlledState = (hooks) => {
hooks.stateReducers.push(reducer);
hooks.useInstance.push(useInstance);
function _isEvent(prop) {
if (0 !== prop.indexOf('on')) {
return false;
}
return true;
}
function _getEvents(obj) {