62
loading...
This website collects cookies to deliver better user experience
grid
, flex
and position
properties, I've had entered and submitted some search criteria, e.g. pizza/Berlin
and I'm under URL with search?term=pizza&location=Berlin
query string. My browser shows me the rendered list of pizzerias in Berlin.
entering
state is emptied ({food: "", town: ""}
).
submitting
state contains {food: "pizza", town: "Berlin"}
.
KEY STEP: I'm reloading the browser.
Render is gone (as I wanted and expected), so I can see only Input
fields and Search
button.
submitting
state is emptied ({food: "", town: ""}
), that's correct too.
search?term=pizza&location=Berlin
query string.useHistory
hook and history
object to generate query string. I did it in Inputs
component. Right know, in this step, I'll use the same method in App
component to remove it:netlify.toml
configuration file with some redirects rules. Right now I need to update them with this code:I repeat steps 1-3 from previous use case
KEY STEP: without clicking at homepage
link, nor without reloading the browser, I'm entering some new search criteria, e.g. vegan/Sydney
and submitting them.
as a result of this new search, my submitting
state contains {food: "vegan", town: "Sydney"}
as it should
also query string is correct: search?term=vegan&location=Sydney
vegan/Sydney
I check my DevTools:useEffect
hook. In step 7.2 (part 2) I passed submitting
state, as prop, to Fetched
component. Now it's time to use it:submitting
state will change, fetchingYelpFx
function will run, which means fetching will be triggered. I repeat the whole USE CASE again and after submission of vegan/Sydney
I check my DevTools:pizza
, but I do not specify any town. Or, I search for Berlin
, but I do not specify any food. Or, I do not specify anything at all, just click Submit
button./Berlin
SCENARIO:submitting
state contains {food: "", town: "Berlin"}
search?term=&location=Berlin
pizza/
SCENARIO:submitting
state contains {food: "pizza", town: ""}
search?term=pizza&location=
/
SCENARIO:submitting
state contains {food: "", town: ""}
search?term=&location=
/Berlin
SCENARIO is not big deal really, I just get useless data in my render: landmarks, buildings, parks and museums mixed up with food stands, restaurants and cafeterias. Total mess.pizza/
and /
SCENARIOS are bigger problem which must be solved: no render whatsoever, and as if that was not enough, error in browser console:Fetched
component will be rendered:/Berlin
, pizza/
and /
SCENARIOS will not happen.image_url
goes first, name
goes below, rating
and review_count
go next, display_address
and each title
on the end. It looks like this:className
property to div
tag containing all fetched data, p
tags with text data in new, common div
tag with className
property assigned to it:netlify dev --live
command, enter some search criteria, e.g. pizza/Berlin
and submit them.title
below the previous one, like this:className
property to p
tag containing a single fetched title
,categories
constant in new div
tag with className
property assigned to it:netlify dev --live
command, enter some search criteria, e.g. pizza/Berlin
and submit them.titles
instead of to be displayed as a list, are render in one line, like a sentence.title
to the bottom of its associated image
. div className="all-categories"
tag and his parent div className="one-single-record"
tag.netlify dev --live
command, enter some search criteria, e.g. pizza/Berlin
and submit them.titles
are aligned, seems to me style is completed.stoic-bartik-7b88ce
app on app.netlify.com. Since then, this app has not yet been deployed
status and to make it accessible via http
protocol, I need to run public live session with netlify dev --live
command. In the long run it's inconvenient, because each session generates random URL. I need to deploy my app to the Netlify server and make it available online under fixed URLyarn build
command which generates minified production build. It works like this:yarn build
command is used, a new build
directory is created in my repo:netlify deploy --prod
command is used, app is fully deployed to app.netlify.com and is available online under fixed URL. pizza/Berlin
and submit them.