-
Notifications
You must be signed in to change notification settings - Fork 18
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
Issue when using react #20
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,21 @@ pf.animal.search() | |
}); | ||
``` | ||
|
||
Another way if you have issues with the above code snippet and using React | ||
|
||
```js | ||
import { Client } from "@petfinder/petfinder-js"; | ||
|
||
const pf = new Client({ | ||
apiKey: "my-api-key", | ||
secret: "my-api-secret", | ||
}); | ||
|
||
const results = await pf.animal.search() | ||
console.log(results.data.animals) | ||
}; | ||
``` | ||
|
||
## Usage (Node/CommonJS) | ||
|
||
```js | ||
|
@@ -70,6 +85,21 @@ client.animal.search() | |
}); | ||
``` | ||
|
||
## If using primary_photo_cropped, some dogs or cats won't have images. I recommend adding a placeholder like below example if using React | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is wordy for a title There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was just putting a disclaimer but you can adjust how you see fit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps italicized would be better? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that or bold. Either way it would be better than just making it a title |
||
|
||
```jsx | ||
|
||
<img | ||
src={ | ||
animal.primary_photo_cropped | ||
? animal.primary_photo_cropped.small | ||
: "https://source.unsplash.com/1600x900/?pets" | ||
} | ||
alt="" | ||
/> | ||
|
||
``` | ||
|
||
## Documentation | ||
|
||
See [docs directory](docs/) for more detailed documentation. |
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 snippet better fits under the TypeScript/ES6 Module section. Do you want to replace that snippet with this one and then update the title to include 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.
Or we could also create a new Usage (React) section and add this and the jsx under that.
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 personally would just completely replace the snippet with React example, but if you want to make a separate section for React that would be fine too.
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.
React is different than browser, so I would keep it separate
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.
sounds good!