-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add react example code to the README #183
Conversation
@@ -72,6 +72,49 @@ That's it. Easy as apple pie. | |||
</script> | |||
</body> | |||
</html> | |||
``` | |||
## React example (just loading videomail) |
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.
Gatsby example
``` | ||
## React example (just loading videomail) | ||
```jsx harmony | ||
import React, { Component } from 'react'; |
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.
no semicolons, use the standard linter
|
||
componentDidMount() { | ||
(async() => { | ||
console.log("waiting for videomail client library to load via CDN"); |
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.
remove or make it a comment instead
componentDidMount() { | ||
(async() => { | ||
console.log("waiting for videomail client library to load via CDN"); | ||
while(window.VideomailClient === undefined) |
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.
what if the remote resource is not available due to some network issues? this would loop forever ...
<Helmet> | ||
<script src="https://cdn.rawgit.com/binarykitchen/videomail-client/2.14.2/prototype/js/videomail-client.min.js" /> | ||
</Helmet> | ||
{ |
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.state.videomailClient && this.renderVideomail() }
would look easier to read
Thanks for this! Honestly I am not a fan of using CDN. Understand it's a limitation due to Gatsby being a SSR. That would mean your example is actually for Gatsby itself, not React. Because in a normal client-side React app we wouldn't have this problem. Submitted a review. |
Good point! Thanks for the review, I'll fix those issues. This is definitely a Gatsby example. I can cook up a react example, would you prefer to have the gatsby example on file somewhere or just a plain react example? |
Thanks. Plain React please. |
f3872a1
to
944e61d
Compare
Submitting this is a talking point, feel free to suggest another way of adding this documentation.
I had to load using the CDN because of #181.