diff --git a/.gitignore b/.gitignore index f7e5569..165c8fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ examples/lib/ node_modules index.js +a.js +index.html diff --git a/AliceJS.js b/AliceJS.js index 6e6cec0..7f4765f 100644 --- a/AliceJS.js +++ b/AliceJS.js @@ -127,25 +127,8 @@ export function useValue(references) { return reference.proxy[reference.property]; } -// Hack to skip use() when there's only one possible property -Object.defineProperty(window, "h", { - get: () => { - __reference_stack = []; - return (type, props, ...children) => { - let references = __reference_stack; - references[ALICEJS_REFERENCES_MARKER] = true; - - if (references.length == 1 && children.length == 1) { - __reference_stack = []; - return h(type, props, references); - } else { - return h(type, props, ...children); - } - }; - } -}); // Actual JSX factory. Responsible for creating the HTML elements and all of the *reactive* syntactic sugar -function h(type, props, ...children) { +export function h(type, props, ...children) { if (typeof type === "function") { let newthis = stateful({}); diff --git a/README.md b/README.md index 2752a36..c754e12 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ function App() {
- {this.counter} + {use(this.counter)}
- Value: {use(this.counter)} + Value: {counter}