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

support react 18 #1020

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

Merged
Miloas merged 1 commit into LeetCode-OpenSource:master from InfiniteXyy:feat/react-18
Jun 19, 2022
Merged

Conversation

Copy link
Contributor

@InfiniteXyy InfiniteXyy commented Jun 14, 2022

This PR is based on #1019.

In React 18, external state management may not work due to concurrent mode. To sync state, we have to use the useSyncExternalStore hook.

Luckily, React officially provides a lib, https://www.npmjs.com/package/use-sync-external-store, to ship support for both React 17 and 18.

In this PR, I installed that hook, and made some refactoring to compat the use-sync-external-store API. All the test cases and ts defination have not been changed.

Miloas reacted with thumbs up emoji
Copy link

codecov bot commented Jun 14, 2022
edited
Loading

Codecov Report

Merging #1020 (5c4a0ee) into master (ea4aca7) will not change coverage.
The diff coverage is 100.00%.

@@ Coverage Diff @@
## master #1020 +/- ##
=========================================
 Coverage 100.00% 100.00% 
=========================================
 Files 2 2 
 Lines 51 57 +6 
 Branches 6 5 -1 
=========================================
+ Hits 51 57 +6 
Impacted Files Coverage Δ
src/use-event-callback.ts 100.00% <100.00%> (ø)
src/use-observable.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea4aca7...5c4a0ee. Read the comment docs.

Copy link
Contributor

Miloas commented Jun 19, 2022

LGTM!

@Miloas Miloas merged commit c3b2ec7 into LeetCode-OpenSource:master Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /