Skip to content

Commit 142d853

Browse files
committed
Merge branch 'feature/member-custom-hooks'
2 parents d8db5d5 + d4cd586 commit 142d853

File tree

3 files changed

+242
-140
lines changed

3 files changed

+242
-140
lines changed

docs/reactivity.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,16 @@ function createCustomStore() {
236236
);
237237
}
238238

239+
const [array] = createSignal([]);
240+
const result = mapArray(array, (item, i) => {
241+
i();
242+
});
243+
244+
const [array] = createSignal([]);
245+
const result = indexArray(array, (item) => {
246+
item();
247+
});
248+
239249
```
240250

241251
### Valid Examples
@@ -413,6 +423,9 @@ createFoo({ onBar: () => bar() });
413423
const [bar, setBar] = createSignal();
414424
X.createFoo(() => bar());
415425

426+
const [bar, setBar] = createSignal();
427+
X.Y.createFoo(() => bar());
428+
416429
const [signal, setSignal] = createSignal(1);
417430
const element = document.getElementById("id");
418431
element.addEventListener(
@@ -499,12 +512,6 @@ styled.css`
499512
color: ${(props) => props.color};
500513
`;
501514

502-
createCss`color: ${props.color}`;
503-
504-
styled.createCss`
505-
color: ${props.color};
506-
`;
507-
508515
function Component() {
509516
let canvas;
510517
return <canvas ref={canvas} />;
@@ -544,6 +551,16 @@ function createCustomStore() {
544551
);
545552
}
546553

554+
function createCustomStore() {
555+
const [store, updateStore] = createStore({});
556+
557+
return indexArray(
558+
// the first argument to mapArray is a tracked scope
559+
() => store.path.to.field,
560+
(item) => ({})
561+
);
562+
}
563+
547564
```
548565
<!-- AUTO-GENERATED-CONTENT:END -->
549566

@@ -571,5 +588,5 @@ Notes:
571588
"bubble up" forever, though; as soon as you reach a scope where one
572589
contained reactive primitive was declared, the current function should
573590
match a tracked scope that expects a function.
574-
- This rule ignores object and class methods completely. Solid is based on
575-
functions/closures only, and it's uncommon to see methods in Solid code.
591+
- This rule ignores classes. Solid is based on functions/closures only, and
592+
it's uncommon to see classes with reactivity in Solid code.

0 commit comments

Comments
 (0)