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 I13n 3.0.0 #224

Closed
14 of 17 tasks
roderickhsiao opened this issue Mar 25, 2019 · 11 comments
Closed
14 of 17 tasks

React I13n 3.0.0 #224

roderickhsiao opened this issue Mar 25, 2019 · 11 comments
Assignees

Comments

@roderickhsiao
Copy link
Collaborator

roderickhsiao commented Mar 25, 2019

Use as a master tracker for 3.0.0 release.

Enhancement:

  • [3.0.0-alpha.0] Modernize package, publishing ES module and CJS
  • Move to new React context API update for the React 16.3 changes #190
  • Use new React forward ref API
  • Modernize build, and make sure test run reliably
  • Replace deprecated React lifecycle
  • Update documentation and tests

Good to have enhancement

Breaking Changes

  • [3.0.0-alpha.0] Drop mixin usage
  • [3.0.0-alpha.0] Drop deprecated props followLink
  • [3.0.0-alpha.0] Remove Node 6 supports (EOL 2019-04-30)
  • [3.0.0-alpha.1] Require React 16.6
  • [3.0.0-alpha.5] require intersection-observer polyfill if you are need to support browsers doesnt have the function
  • [3.0.0-alpha.5] Switch to hook so server side won't behave the same as before

[3.0.0-alpha.0] #218
[3.0.0-alpha.1] #226
[3.0.0-alpha.2] #228
[3.0.0-alpha.3] #229
[3.0.0-alpha.5] #259

@antonychan
Copy link

Regarding the move to the new context api (#190), I created a sample repo with some of the issues we're facing today: https://github.com/antonychan/react-i13n-context. Hopefully can provide you some use cases to work with!

We have some components that consume more than one context. We can get around that issue now by using a higher-order-component like withI13nContext in the repo passes down the i13n context object as a prop to its children.

In the repo, I created three components that consume multiple contexts in different ways:

  1. AwesomeComponent attempts to use both contextType and contextTypes to consume multiple contexts which results in a warning. contextTypes will be ignored in this case.

  2. AwesomeComponentWithRenderProps shows consuming multiple contexts using renderProps.

  3. AwesomeComponentWithUseContext shows consuming multiple contexts with useContext.

In the renderProps example, moving to the new context API (and exposing the consumer) should allow us to nest multiple consumers (https://reactjs.org/docs/context.html#consuming-multiple-contexts)

In the useContext example, seems like it would be useful if we could use an exposed I13nContext:

const i13nContext = useContext(I13nContext);
const someContext = useContext(SomeContext);

@roderickhsiao roderickhsiao self-assigned this Mar 27, 2019
@redonkulus
Copy link
Contributor

@roderickhsiao whats the status of this?

Also what are your thoughts on introducing hooks?

@roderickhsiao
Copy link
Collaborator Author

@redonkulus going to try the context for the next change, hopefully I can made it.

I think internally we can use hook, and provide both hooks and HOC externally (for people using class) to access i13n method, this we should be able to simplified the logic

@danhuang1202
Copy link
Contributor

danhuang1202 commented Jul 21, 2020

Hi @roderickhsiao , is there any task unassigned that I can help with upgrading react-i13n to 3.0.0 ?

@roderickhsiao
Copy link
Collaborator Author

If anyone can help #259 will unblock the biggest task for 3.0.0 :)

@redonkulus
Copy link
Contributor

@roderickhsiao my yearly check-in on this migration work. What is left to be done? Looks like #259 was merged a while ago.

@roderickhsiao
Copy link
Collaborator Author

I think only documentation left, the code should be stable enough.

@roderickhsiao
Copy link
Collaborator Author

@redonkulus I'll try removing grunt and modernize the build probably this week or next

@redonkulus
Copy link
Contributor

@roderickhsiao awesome. lets make sure the docs are ok too. I think they are based on your context PR.

@redonkulus
Copy link
Contributor

then we can get 3.0.0 published and out of alpha.

@redonkulus
Copy link
Contributor

3.0.0 has been released, we can close this now.

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

4 participants