Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

docs: Update README.md#520

Merged
Rich-Harris merged 3 commits intosveltejs:mainfrommatzar:patch-1
Dec 15, 2023
Merged

docs: Update README.md#520

Rich-Harris merged 3 commits intosveltejs:mainfrommatzar:patch-1
Dec 15, 2023

Conversation

@matzar
Copy link
Contributor

@matzarmatzar commentedOct 13, 2023
edited
Loading

Docs: 04-updating-arrays-and-objects

Ensured clarity in the example code by defining theobj object. This ensures that readers understand the context and structure of the object being modified in the reactivity example.

Because it is possible to trigger reactivity by referencingfoo.bar in the template instead ofobj.foo.bar, the following will trigger reactivity:

<script>letobj={foo:{bar:'old'}};constfoo=obj.foo;functionupdateFooBar(){foo.bar='baz';}</script><buttonon:click={updateFooBar}>Update foobar</button><!-- referencing the variable with `foo.bar` - triggers reactivity --><p>baz is: {foo.bar}</p>

However, the next example will not, and will requireobj = obj reassignment:

<script>letobj={foo:{bar:'old'}};constfoo=obj.foo;functionupdateFooBar(){foo.bar='baz';// uncomment below to trigger reactivity// obj = obj}</script><buttonon:click={updateFooBar}>Update foobar</button><!-- referencing the variable with `obj.foo.bar` - does **not** trigger reactivity --><p>baz is: {obj.foo.bar}</p>

In this case,{obj.foo.bar} does not trigger reactivity whenfoo.bar is updated, unlessobj is reassigned (withobj = obj).

By including the definition of theobj object, we aim to elucidate the structure and context in which the reactivity example operates, ensuring a clearer understanding for the reader.

docs: 04-updating-arrays-and-objects, add `let obj = { foo: { bar: 'old' } };` for more clarity
@vercel
Copy link

vercelbot commentedOct 13, 2023

@matzar is attempting to deploy a commit to theSvelte Team onVercel.

A member of the Team first needs toauthorize it.

@Rich-Harris
Copy link
Member

thanks!

@Rich-HarrisRich-Harris merged commitda3e539 intosveltejs:mainDec 15, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

1 more reviewer

@Rich-HarrisRich-HarrisRich-Harris approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@matzar@Rich-Harris

[8]ページ先頭

©2009-2025 Movatter.jp