UNPKG

informed

Version:

A lightweight framework and utility for building powerful forms in React applications

32 lines (28 loc) 727 B
import React, { useContext } from 'react'; import { ScopeContext } from '../Context.js'; // eslint-disable-next-line no-unused-vars var Scope = function Scope(_ref) { var scope = _ref.scope, children = _ref.children; // Name might be scoped var parentScope = useContext(ScopeContext); var newScope; // Example: // parentScope = undefined // scope = father // ==> father if (!parentScope) { newScope = scope; } // Example: // parentScope = father // scope = bestFriend // ==> father.bestFriend else { newScope = "".concat(parentScope, ".").concat(scope); } return /*#__PURE__*/React.createElement(ScopeContext.Provider, { value: newScope }, children); }; export { Scope };