UNPKG
mini-react-dom
Version:
latest (0.0.3)
0.0.3
0.0.2
0.0.1
0.0.0
A lightweight React-like DOM renderer with JSX, hooks, context, SSR and lazy support
mini-react-dom
/
src
/
core
/
context.js
15 lines
(13 loc)
•
284 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
export
function
createContext
(
defaultValue
) {
const
context = {
Provider
:
(
{ value, children }
) =>
{ context.
_value
= value;
return
children; },
_value
: defaultValue, };
return
context; }
export
function
useContext
(
Context
) {
return
Context
.
_value
; }