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

Add reactive destructuring to cheatsheet #211

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

frederikhors
Copy link
Contributor

No description provided.

@netlify
Copy link

netlify bot commented Jan 18, 2022

✔️ Deploy Preview for sveltesociety-preview ready!

🔨 Explore the source changes: 8db2c5b

🔍 Inspect the deploy log: https://app.netlify.com/sites/sveltesociety-preview/deploys/61e6d16254109100081c7e55

😎 Browse the preview: https://deploy-preview-211--sveltesociety-preview.netlify.app

@@ -437,6 +437,8 @@ onMount(() => {
alert('count is dangerously high!')
count = 9
}

$: ({ab, cd, ef: {gh} = {gh: {}}} = alphabet)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit hard to understand what you trying to do.
And furthermore, the code is "invalid": alphabet is undefined

Something like that seem easier to understand:

Suggested change
$: ({ab, cd, ef: {gh} = {gh: {}}} = alphabet)
let myObject = {a: 10, b: 20, c: { d: "hello" }}
$: ({a, b, c} = myObject)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to make this code as difficult as possible to explain well what is possible to do.

Maybe the below is better?

let myObject = {a: 10, b: 20, c: { d: "hello" }}

$: ({a, b, c, e: {f} = {f: "default"}} = myObject)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if there are any themes being used in the cheatsheet, but one device I've seen work well is to explain things with super heroes. Otherwise, finding something with short identifiers (e.g. coordinates) might be more useful than asking the reader to assign identifiers meaning on the fly while trying to grok the concept.

@MacFJA MacFJA added the stale Issue or PR haven't be update for a while label Oct 10, 2022
@benmccann benmccann changed the base branch from staging to main July 9, 2023 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issue or PR haven't be update for a while
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants