Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] update intro sentence of reactive declarations tutorial #7467

Merged
merged 2 commits into from
Jul 11, 2022

Conversation

simondao
Copy link
Contributor

The sentence "Often, some parts of a component's state need to be computed from other parts (such as a fullname derived from a firstname and a lastname), and recomputed whenever they change." was very confusing and also grammatically incorrect because "and recomputed whenever they change" is a dependent clause.

According to Grammarly, "A dependent clause is a clause that cannot stand as a sentence in its own right, such as before I left the parking lot. When a complex sentence contains a dependent clause like this one, a comma is not used unless the dependent clause comes before the independent clause."

https://www.grammarly.com/blog/comma-in-complex-sentences/#:~:text=A%20dependent%20clause%20is%20a,comes%20before%20the%20independent%20clause.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with [feat], [fix], [chore], or [docs].
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with npm test and lint the project with npm run lint

The sentence "Often, some parts of a component's state need to be computed from other parts (such as a fullname derived from a firstname and a lastname), and recomputed whenever they change." was very confusing and also grammatically incorrect because "and recomputed whenever they change" is a dependent clause.

According to Grammarly, "A dependent clause is a clause that cannot stand as a sentence in its own right, such as before I left the parking lot. When a complex sentence contains a dependent clause like this one, a comma is not used unless the dependent clause comes before the independent clause."

https://www.grammarly.com/blog/comma-in-complex-sentences/#:~:text=A%20dependent%20clause%20is%20a,comes%20before%20the%20independent%20clause.
@benmccann
Copy link
Member

I think it was better before. Though I agree the comma in the prior text was not necessary and would be fine removing it. I think now it has become much more verbose to say the same thing. The verbosity in this case, in my opinion, makes it harder to follow.

I think the fullname, firstname, lastname example maybe could even be removed altogether because the code example uses doubled and count. It doesn't really add much to have two examples and I think might just confuse things to have the text and code block using different variables

@simondao
Copy link
Contributor Author

simondao commented Apr 24, 2022 via email

@benmccann
Copy link
Member

I think the "and also want to recompute fullname when firstname and/or lastname changes" is unnecessary as the recomputation is implied by the word "derived". The "and/" is unnecessary since firstname and lastname aren't updated atomically. And the "For these" portion no longer reads correctly as it's a new sentence preceding it.

More importantly, I think the whole text is a distraction. It's going off describing what derived state is using an example that's different than the one used on the page.

How about something like this?


Svelte automatically updates the DOM when your component's state changes. It can also update derived state automatically with reactive declarations.

Here's an example where the derived variable doubled will be automatically updated:

let count = 0;
$: doubled = count * 2;

@simondao
Copy link
Contributor Author

simondao commented Apr 25, 2022 via email

@simondao
Copy link
Contributor Author

simondao commented Apr 26, 2022 via email

@benmccann
Copy link
Member

Sure, that mostly sounds good to me. I think we'd need to update the following sentence slightly and I'd drop "system of". With those changes it could look like:

Svelte's reactivity not only keeps the DOM in sync with your application's variables as shown in the previous section, it can also keep variables in sync with each other using reactive declarations. They look like this:

@benmccann benmccann changed the title Update text.md [docs] update intro sentence of reactive declarations tutorial May 6, 2022
@simondao
Copy link
Contributor Author

simondao commented May 6, 2022 via email

@benmccann benmccann merged commit 60024ef into sveltejs:master Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants