-
Notifications
You must be signed in to change notification settings - Fork 24
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
ENDOC-504 Start updating the React MFE tutorial. #514
Conversation
We'll use [Create React App](https://create-react-app.dev/) to generate a simple app in seconds. | ||
1. Create 'my-widget' directory structure with the following: | ||
## Create a React App | ||
[Create React App](https://create-react-app.dev/) allows you to generate a simple app in seconds. |
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.
Not sure, but should there be a 'the' at the beginning of sentence?
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.
not in this case: https://create-react-app.dev
``` bash | ||
npx create-react-app my-widget --use-npm | ||
``` | ||
|
||
This is the expected output: | ||
This tutorial updates the following files: |
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.
Is 'update' accurate, since you are building this now? Maybe build?
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.
so, it's a fine distinction, but the tutorial doesn't build anything; instead it requires the files built by Create React App to be updated
|
||
1. Add a new file `src/WidgetElement.js` with the following custom element to wrap the entire React app | ||
The steps below wrap the app component with an HTML custom element. The `connectedCallback` method renders the React app when the custom element is added to the DOM. |
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.
should DOM be explained or is it known enough
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 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.
@Lyd1aCla1r3 @jyunmitch I think it's well enough known. If someone knows React enough to care about these details, they absolutely know what the DOM is.
|
||
``` html | ||
<my-widget /> | ||
``` | ||
|
||
3. Your browser window should automatically redisplay the React App. | ||
3. Observe your browser automatically redisplay the React app |
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.
redisplay >> display
very minor but it's the first time 'your' browser is displaying the thing...
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.
nope - it was already displayed once before, and this action refreshes it
2nd time - line 38. use of "your" is consistent here
|
||
2. Click `Create folder` and name it 'my-widget'. This needs to match the .env.production path from above. | ||
2. Click `Create folder` and name it "my-widget" to match the `.env.production` path above |
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.
why is this in quotes? confused
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 a field entry, not the field itself, so no backticks; quotes are used above to supply field values
|
||
3. Click `Save` | ||
|
||
4. Click `my-widget` | ||
|
||
5. Create the same folder structure as your generated build directory | ||
5. Create a folder structure similar to your generated build directory: |
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.
similar threw me off a little, because it made me wonder if I could change the names a littl
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.
you can! strictly speaking the structure isn't identical
|
||
2. Choose an existing page (or create a new one (LINK TODO)) and click `Actions`→ `Design`. | ||
2. Choose an existing page (or [create a new one](../../compose/page-management.md#create-a-page)) and select `Design` from its Actions |
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.
debating whether the Actions should be backticked
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.
i opted not to because it's not a label or entity
No description provided.