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

Upgrade React to 16.8.4: Welcome React Hooks #14400

Merged
merged 2 commits into from
Mar 13, 2019

Conversation

youknowriad
Copy link
Contributor

Second attempt to upgrade React. Now that react-native 0.59 stable is out, we can move forward with the web. The mobile team can update when they sync master to develop.

@youknowriad youknowriad self-assigned this Mar 13, 2019
@youknowriad youknowriad requested a review from hypest March 13, 2019 09:53
@youknowriad youknowriad added the Framework Issues related to broader framework topics, especially as it relates to javascript label Mar 13, 2019
@youknowriad youknowriad changed the title Upgrade React to 16.8.2: Welcome React Hooks (#13992) Upgrade React to 16.8.2: Welcome React Hooks Mar 13, 2019
@youknowriad youknowriad changed the title Upgrade React to 16.8.2: Welcome React Hooks Upgrade React to 16.8.4: Welcome React Hooks Mar 13, 2019
* Upgrade React to 16.8.4

* Update package-lock.json file

* Expose React Hooks
"react": "^16.8.4",
"react-dom": "^16.8.4"
},
"dependencies": {
Copy link
Member

Choose a reason for hiding this comment

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

This part should be manually removed. The same versions of packages are now in the root of the lock file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why do we need to do these manual tweaks? It seems to work as is?

Copy link
Contributor Author

@youknowriad youknowriad Mar 13, 2019

Choose a reason for hiding this comment

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

Oh I think it's because they're considered "dev" dependencies at the root level, this means npm marks them as "dev": true, at the root level but also add them here as normal dependencies. I think we should keep them as is.

"react-test-renderer": "16.6.3",
"react": "16.8.4",
"react-dom": "16.8.4",
"react-test-renderer": "16.8.4",
Copy link
Member

Choose a reason for hiding this comment

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

It's surprising that react-test-renderer wasn't listed before 🤷‍♂️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

react wasn't listed before.

Copy link
Member

Choose a reason for hiding this comment

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

Right :)

@oandregal oandregal self-requested a review March 13, 2019 14:52
@gziolo
Copy link
Member

gziolo commented Mar 13, 2019

I added cd61281 which performs some cleanup to ensure we use only one version of React dependencies.

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

Tested locally, everything works great. You can 🚢 if you are fine with the lock file changes I applied.

@gziolo gziolo added this to the 5.3 (Gutenberg) milestone Mar 13, 2019
@youknowriad youknowriad merged commit c7d14ca into master Mar 13, 2019
@youknowriad youknowriad deleted the update/react-16.8-try-2 branch March 13, 2019 15:26

[src/index.js#L1-L1](src/index.js#L1-L1)

Make React Hooks available
Copy link
Member

@aduth aduth Mar 13, 2019

Choose a reason for hiding this comment

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

These aren't the most helpful documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mmm Right I didn't notice, we might want to just link to the React Docs here. how can we improve this, I'm not yet familiar with this new doc generator @nosolosw

Copy link
Member

Choose a reason for hiding this comment

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

We can do a couple of options:

  • Change this comment to Refer to React docs https://reactjs.org/docs/hooks-reference.html. That'd the quick/easy way.

  • Export every item independently as we did with the others. In the JSDoc comment, we can refer to the specific React hook reference like @see https://reactjs.org/docs/hooks-reference.html#usecallback.

Copy link
Member

Choose a reason for hiding this comment

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

I'm preparing a PR for the second option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Awesome Thank you :)

Copy link
Member

Choose a reason for hiding this comment

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

#14425 could be the minimum viable docs.

Tug added a commit that referenced this pull request Mar 14, 2019
…/fix-develop

Merge up until just before "Upgrade React to 16.8.4: Welcome React Hooks (#14400)"
@aduth
Copy link
Member

aduth commented Mar 20, 2019

At the risk of stating the obvious, it should be noted that in bringing @wordpress/element@2.3.0 into core, we should plan to bump the version of React shipped there.

https://github.com/WordPress/wordpress-develop/blob/34251aa2abe8dcc4cbc9fb6d052a84c95b78162e/package.json#L109-L110

https://github.com/WordPress/wordpress-develop/blob/34251aa2abe8dcc4cbc9fb6d052a84c95b78162e/src/wp-includes/script-loader.php#L94-L95

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework Issues related to broader framework topics, especially as it relates to javascript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants