-
Notifications
You must be signed in to change notification settings - Fork 3
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
doc: Update README.md #33
base: main
Are you sure you want to change the base?
Conversation
0c3c338
to
06e9dff
Compare
At the top of the file there's a link to a banner image: react-migration-toolkit/README.md Line 1 in 06e9dff
|
06e9dff
to
cccb79a
Compare
That's removed ✔️ |
c932030
to
108b52f
Compare
|
||
Additional providers might be needed for your app. For example, the toolkit provides the following providers and associated hooks: | ||
|
||
- `RawIntlProvider` (for `react-intl`) → `useIntl` (requires passing the Ember `intl` instance from `useEmberIntl`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not provided by the package per se (at lest not currently), consumers of the addon need to install react-intl and pass the result of useEmberIntl themselves to RawIntlProvider, which is coming the react-intl package.
README.md
Outdated
|
||
#### `providersOptions` (optional) | ||
|
||
To have access to the Launch Darkly feature flags in react components, use `ReactBridgeWithProviders` instead of `ReactBridge`, and in the react component you will then be able to use the flags hook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's no ReactBridgeWithProviders
in this package, also I feel like this text is focusing too much on LD / flags. It's unclear what providerOptions mean here
README.md
Outdated
<ReactBridgeWithProviders | ||
@reactComponent={{this.TransactionsSidebarFooter}} | ||
@props={{hash | ||
highlightedItem=@highlightedItem | ||
handleShowHelpSection=@handleShowHelpSection | ||
className=(local-class "footer") | ||
}} | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, this component is created (optionally) on the consumer's side, it's not provided here
README.md
Outdated
In the React component you can use the `useFlags` hook imported from `@qonto/react-migration-toolkit/react/hooks` which is accessible from the flags object (in camelCase) | ||
|
||
It renders React components within Ember templates, permitting progressive UI migration and preserving existing logics and tests. | ||
Example: | ||
|
||
Full documentation can be found [here](https://www.notion.so/qonto/How-to-use-React-components-in-Ember-applications-e2f8513fc4a442b0967274d9e57b18b0) (Qonto VPN must be on). | ||
```jsx | ||
const { featurePrismicZendeskMigration } = useFlags() | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't seem related to the section, and maybe we should remove stuff about LD for now
|---------------------|-------------------------------------------|----------|---------| | ||
| reactComponent | ComponentType | Yes | None | | ||
| props | object | No | None | | ||
| providersComponent | ComponentType<{ children: ReactNode } & P> | No | None | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't seem right, in the current state of things, this should be providerOptions
with component
and props
inside
const { featurePrismicZendeskMigration } = useFlags() | ||
``` | ||
|
||
#### `component` prop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks unclear where this is coming from here, this is not really a "prop" and it's one of the keys of the providerOptions
argument
|
||
- `RawIntlProvider` (for `react-intl`) → `useIntl` (requires passing the Ember `intl` instance from `useEmberIntl`) | ||
- `PolymorphicRouterContextProvider` → `useRouter` | ||
- `LDProvider` (LaunchDarkly) → `useFlags` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's more setup to do on the apps side to make LDProvider works, it's just easier if we don't document it for now
|
||
[This branch](https://gitlab.qonto.co/front/qonto-js/-/blob/bifrost/app/components/react-bifrost.hbs) uses the ReactBridge extensively and can be checked for reference. | ||
#### `props` prop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as the "component" comment, I think it's not super clear
README.md
Outdated
|
||
#### `tagName` prop | ||
|
||
By default, the bridge will wrap the React component in a `div` which sometimes this breaks the semantic flow. For example, a `table` can not have a `div` element as a child. With this, we can to set another tag dynamically to wrap the react component which solves this problem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, the bridge will wrap the React component in a `div` which sometimes this breaks the semantic flow. For example, a `table` can not have a `div` element as a child. With this, we can to set another tag dynamically to wrap the react component which solves this problem. | |
By default, the bridge will wrap the React component in a `div` which sometimes breaks the semantic flow. For example, a `table` cannot have a `div` element as a child. With this, we can set another tag dynamically to wrap the react component which solves this problem. |
some typos here
README.md
Outdated
import { useEmberService } from '@qonto/react-migration-toolkit/react/hooks'; | ||
|
||
export const useOrganizationManager = () => { | ||
return useEmberService('organization-manager'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use a more generic service name here?
README.md
Outdated
|
||
To make sure the correct types is available when a service is injected with `useEmberService` hook, the service should be declared in Ember’s dependency injection registry which will be then used through [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html). | ||
|
||
```tsx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this is a typescript file, not tsx
README.md
Outdated
|
||
The same API of the Ember service is available after exposing it via the hook. | ||
|
||
To make sure the correct types is available when a service is injected with `useEmberService` hook, the service should be declared in Ember’s dependency injection registry which will be then used through [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is optional, and I would use a wording closer to what's in the official docs here (check the last section)
README.md
Outdated
<details> | ||
<summary>How to test React components in Ember</summary> | ||
|
||
Testing for React is currently done via **QUnit** and existing Ember test suites should still largely be compatible with migrated components. Changing framework should not impact components behavior. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the way this is phrased, this sounds more like an internal note than public documentation
f68ef96
to
83ad31c
Compare
doc: add LICENSE.md file
83ad31c
to
11fccd4
Compare
No description provided.