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

关于极简react的Demo的问题 #74

Open
blazer233 opened this issue May 6, 2021 · 2 comments
Open

关于极简react的Demo的问题 #74

blazer233 opened this issue May 6, 2021 · 2 comments

Comments

@blazer233
Copy link

// 环状单向链表操作
  if (queue.pending === null) {
    update.next = update;
  } else {
    update.next = queue.pending.next;
    queue.pending.next = update;
  }
  queue.pending = update;

既然queue.pending保存着上个update,next指向自己,是否也可写为

...
  } else {
    update.next = queue.pending;
    queue.pending.next = update;
  }
...
@BetaSu
Copy link
Owner

BetaSu commented May 6, 2021

按后一种写法3个节点及以上无法形成正确的环

@blazer233
Copy link
Author

按后一种写法3个节点及以上无法形成正确的环

谢谢大佬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants