Closed jonathanbossenger closed 6 months ago
//lesson
https://github.com/WordPress/Learn/assets/180629/599eb442-ff32-4b80-a550-c2768382ac55
Video ready for review
Please follow the Guidelines for reviewing content to review this lesson.
@jonathanbossenger, great tutorial!
I have one suggestion: at 10:52, you mention people can leave the wp-api
dependency but don't explain why. After watching, I wonder why not switch the order and spend more time demonstrating how to use the two newer options instead of focusing on the Backbone.js
client and only mentioning the api-fetch package
as an alternative.
In this context, I would have liked to know the differences between these three options at the beginning of the hands-on demo rather than closing with it (at ~16:20). Especially since the next lesson (#2267) only uses the api-fetch
package.
I have one suggestion: at 10:52, you mention people can leave the wp-api dependency but don't explain why.
There's no real reason as to why or why not, it largely depends on the use case. This specific example code isn't something one would use in the real world (building a form that has more than one way to fetch the data), so I was just pointing it out.
What I'm trying to avoid is someone thinking you have to include wp-api
to be able to use wp-api-fetch
, which you don't.
After watching, I wonder why not switch the order and spend more time demonstrating how to use the two newer options instead of focusing on the Backbone.js client and only mentioning the api-fetch package as an alternative.
So this one is a tricky one.
First off, I don't think I'm focusing on the Backbone.js client, it's just the first option being presented.
The reason for this is that, at the moment, the section on using the WP REST API only lists the Backbone.js client. With the advent of the block editor, the api-fetch package was added, but it's not referenced in the WP REST API docs, only in the block editor docs. So someone reading the WP REST API docs might wonder why this lesson doesn't reference it.
Additionally, the core-data package only works in a React app, so if you're building something outside of React, you'd have to use one of the other options.
This means that for this lesson, I have to cover at least the two current options that are available for a React context.
That's another reason I include the wrap-up at the end, instead of upfront. The lesson is not prescribing which option should be the default, they're all available, and all have their uses.
The other reason that I'm only presenting the three options here, and future lessons only use api-fetch as examples is that including the same 3 options for each of the next lessons makes those lessons that much longer, and I'm also fighting for time.
I would also add that I would like to do a more in-depth series of lessons around using the WP REST API to build applications in a later learning pathway, but these initial lessons are very much introductory.
Thanks for the explanation, @jonathanbossenger! It's always interesting to understand the “why”, so I appreciate you taking the time 🤓
//publish
Details
Learning Objectives
Related Resources and Other Notes
Automation Code
//lesson