UNPKG

@uiw/react-json-view

Version:
32 lines 965 B
import _extends from "@babel/runtime/helpers/extends"; import { createContext, useContext, useReducer } from 'react'; import { jsx as _jsx } from "react/jsx-runtime"; var initialState = {}; var Context = /*#__PURE__*/createContext(initialState); var reducer = (state, action) => _extends({}, state, action); export var useExpandsStore = () => { return useContext(Context); }; var DispatchExpands = /*#__PURE__*/createContext(() => {}); DispatchExpands.displayName = 'JVR.DispatchExpands'; export function useExpands() { return useReducer(reducer, initialState); } export function useExpandsDispatch() { return useContext(DispatchExpands); } export var Expands = _ref => { var { initial, dispatch, children } = _ref; return /*#__PURE__*/_jsx(Context.Provider, { value: initial, children: /*#__PURE__*/_jsx(DispatchExpands.Provider, { value: dispatch, children: children }) }); }; Expands.displayName = 'JVR.Expands';