Guide (Local React App)
An example project guide in creating a Local React App
Github repository for this Walkthrough Guide: https://github.com/zesty-io/zesty-local-react-example
Getting Started with the Example App
#First, we'll need to install the pull-zesty
package. (For more detail, see the docs page on pullzesty
)
Next, lets clone the example app
Now, all we need to do to run is install the required dependencies
Note how calling
npm start
also callspullzesty
Understanding the Example Project
The zesty.yaml
file defines what endpoints we rely on. In this case, we are using two custom endpoints, "/-/basic-api/homepage.json" and "/-/custom/menulist.json"
We save the .json
from these endpoints into src/data
and use the data in our React code. This can be seen in src/Home.js
and src/Menu.js
.
Note how the only difference between the local and remote examples is
componentDidMount
Using componentDidMount
, we're able to load in our JSON and render it accordingly. After we load it in, it's just a matter of parsing a JS Object.
Additionally, it's not too much different to change this to work remotely instead of locally, as the next guide will show.
Connect with Content Experts
Book a free 15-minute consultation with a content expert. Discuss your application, pain points and requirements. Understand how Zesty's lower total cost of ownership, features, functionality can elevate your business by creating extraordinary digital experiences.
Trusted By
G2 MOMENTUM LEADER