Skip to content

Commit

Permalink
Merge branch 'feature/member-custom-hooks'
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwilsonvu committed Jan 10, 2023
2 parents d8db5d5 + d4cd586 commit 142d853
Show file tree
Hide file tree
Showing 3 changed files with 242 additions and 140 deletions.
33 changes: 25 additions & 8 deletions docs/reactivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,16 @@ function createCustomStore() {
);
}

const [array] = createSignal([]);
const result = mapArray(array, (item, i) => {
i();
});

const [array] = createSignal([]);
const result = indexArray(array, (item) => {
item();
});

```

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

const [bar, setBar] = createSignal();
X.Y.createFoo(() => bar());

const [signal, setSignal] = createSignal(1);
const element = document.getElementById("id");
element.addEventListener(
Expand Down Expand Up @@ -499,12 +512,6 @@ styled.css`
color: ${(props) => props.color};
`;

createCss`color: ${props.color}`;

styled.createCss`
color: ${props.color};
`;

function Component() {
let canvas;
return <canvas ref={canvas} />;
Expand Down Expand Up @@ -544,6 +551,16 @@ function createCustomStore() {
);
}

function createCustomStore() {
const [store, updateStore] = createStore({});

return indexArray(
// the first argument to mapArray is a tracked scope
() => store.path.to.field,
(item) => ({})
);
}

```
<!-- AUTO-GENERATED-CONTENT:END -->

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

0 comments on commit 142d853

Please sign in to comment.