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

Removed React context mention in the documentation #2841

Merged
merged 4 commits into from
Jan 31, 2019

Conversation

maoueh
Copy link
Contributor

@maoueh maoueh commented Jan 31, 2019

In the section Translate your own components

@maoueh
Copy link
Contributor Author

maoueh commented Jan 31, 2019

Replaces #2829

Copy link
Collaborator

@djhi djhi left a comment

Choose a reason for hiding this comment

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

s/The react-admin package/React-admin/

Copy link
Collaborator

@djhi djhi left a comment

Choose a reason for hiding this comment

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

s/of wrapped component/of the wrapped component/

```

However, using the context makes components harder to test. That's why react-admin provides a `translate` Higher-Order Component, which simply passes the `translate` function from context to props:
The react-admin package provides a `translate` Higher-Order Component, which simply passes the `translate` function to props of wrapped component:
Copy link
Collaborator

@djhi djhi Jan 31, 2019

Choose a reason for hiding this comment

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

Suggested change
The react-admin package provides a `translate` Higher-Order Component, which simply passes the `translate` function to props of wrapped component:
React-admin provides a `translate` Higher-Order Component, which simply injects the `translate` function to the wrapped component:

Copy link
Collaborator

@djhi djhi left a comment

Choose a reason for hiding this comment

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

Thanks for this PR 👍

@@ -5,7 +5,7 @@ title: "Translation"

# Translation

The react-admin interface uses English as the default language. But it also supports any other language, thanks to the [polyglot.js](http://airbnb.io/polyglot.js/) library.
React-admin interface uses English as the default language. But it also supports any other language, thanks to the [polyglot.js](http://airbnb.io/polyglot.js/) library.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one should have kept the The as we are refering to the interface 😉

```

However, using the context makes components harder to test. That's why react-admin provides a `translate` Higher-Order Component, which simply passes the `translate` function from context to props:
React-admin package provides a `translate` Higher-Order Component, which simply passes the `translate` function to props of the wrapped component:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Last one I think 😄

s/to props of/as a prop to/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Went really too quick :)

@djhi djhi added this to the v2.6.4 milestone Jan 31, 2019
@djhi djhi merged commit 56d7439 into marmelab:master Jan 31, 2019
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

Successfully merging this pull request may close these issues.

2 participants