@kcuf/canvas-marking-react-headless
Version:
The React headless wrapping of @kcuf/canvas-marking.
28 lines • 967 B
JavaScript
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["children"];
import { useReducer } from 'react';
import reducer from '../reducer';
import Context from '../context';
import Lifecycle from '../lifecycle';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export default function Provider(_ref) {
var children = _ref.children,
props = _objectWithoutProperties(_ref, _excluded);
var _useReducer = useReducer(reducer, {
domContainer: null,
markingInstance: null
}),
_useReducer2 = _slicedToArray(_useReducer, 2),
state = _useReducer2[0],
dispatch = _useReducer2[1];
return /*#__PURE__*/_jsxs(Context.Provider, {
value: {
props: props,
state: state,
dispatch: dispatch
},
children: [/*#__PURE__*/_jsx(Lifecycle, {}), children]
});
}
//# sourceMappingURL=index.js.map