UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

30 lines (29 loc) 844 B
/** * DevExtreme (esm/__internal/core/r1/runtime/inferno/create_context.js) * Version: 25.2.5 * Build date: Fri Feb 20 2026 * * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import { Component } from "inferno"; let contextId = 0; export const createContext = function(defaultValue) { const id = contextId++; return { id: id, defaultValue: defaultValue, Provider: class extends Component { getChildContext() { return Object.assign({}, this.context, { [id]: this.props.value || defaultValue }) } render() { return this.props.children } } } };