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

Add react example code to the README #183

Closed
wants to merge 2 commits into from

Conversation

IanPhilips
Copy link

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.

@@ -72,6 +72,49 @@ That's it. Easy as apple pie.
</script>
</body>
</html>
```
## React example (just loading videomail)
Copy link
Owner

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';
Copy link
Owner

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");
Copy link
Owner

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)
Copy link
Owner

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>
{
Copy link
Owner

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

@binarykitchen
Copy link
Owner

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.

@IanPhilips
Copy link
Author

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?

@binarykitchen
Copy link
Owner

Thanks. Plain React please.

@binarykitchen binarykitchen deleted the branch binarykitchen:develop October 1, 2024 00:58
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