jdsutherland

jdsutherland

Modern Front-End Development for Rails: B7 end ch 9 text doesn't mention required changes to pass props to Venue

I suspect you might be aware of this but here goes. If one follows the book, the end of ch 9 will result in errors from the useEffect call in Venue: Started GET "/tickets.json?concert_id=undefined". The reader should be able to figure this out, but the required changes aren’t explicitly listed in the text:

wherever Venue is initiated: packs/venue_display.js didn’t work for me so I’m using packs/application.js (props no longer hard-coded and add concertId):

      <Venue
        rows={parseInt(element.dataset.rows, 10)}
        seatsInRow={parseInt(element.dataset.seatsInRow, 10)}
        concertId={parseInt(element.dataset.concertId, 10)}
      />

concerts/show.html.erb (add data attributes):

  <div id="react-element"
       data-rows="<%= @concert.venue.rows %>"
       data-seats-in-row="<%= @concert.venue.seats_per_row %>"
       data-concert-id="<%= @concert.id %>">
  </div>

Edit: I just noticed there’s bit of a naming mismatch between seats_per_row (Rails) and seatsInRow (React). I figured I’d point that out to you if you weren’t aware.

First Post!

noelrappin

noelrappin

Author of Modern Front-End Development for Rails

The venue_display.js issue I know about and will be clearer about the solution in the text on final pass.

I probably should clear the naming as well, it sounds like the other problem is just that I missed describing a change in the text?

Where Next?

Popular Pragmatic Bookshelf topics Top

New
jeffmcompsci
Title: Design and Build Great Web APIs - typo “https://company-atk.herokuapp.com/2258ie4t68jv” (page 19, third bullet in URL list) Typo:...
New
raul
Hi Travis! Thank you for the cool book! :slight_smile: I made a list of issues and thought I could post them chapter by chapter. I’m rev...
New
joepstender
The generated iex result below should list products instead of product for the metadata. (page 67) iex&gt; product = %Product{} %Pento....
New
adamwoolhether
When trying to generate the protobuf .go file, I receive this error: Unknown flag: --go_opt libprotoc 3.12.3 MacOS 11.3.1 Googling ...
New
leonW
I ran this command after installing the sample application: $ cards add do something --owner Brian And got a file not found error: Fil...
New
curtosis
Running mix deps.get in the sensor_hub directory fails with the following error: ** (Mix) No SSH public keys found in ~/.ssh. An ssh aut...
New
New
SlowburnAZ
Getting an error when installing the dependencies at the start of this chapter: could not compile dependency :exla, "mix compile" failed...
New
dachristenson
I just bought this book to learn about Android development, and I’m already running into a major issue in Ch. 1, p. 20: “Update activity...
New

Other popular topics Top

AstonJ
Curious to know which languages and frameworks you’re all thinking about learning next :upside_down_face: Perhaps if there’s enough peop...
New
AstonJ
I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New
AstonJ
Inspired by this post from @Carter, which languages, frameworks or other tech or tools do you think is killing it right now? :upside_down...
New
PragmaticBookshelf
“A Mystical Experience” Hero’s Journey with Paolo Perrotta @nusco Ever wonder how authoring books compares to writing articles?...
New
DevotionGeo
The V Programming Language Simple language for building maintainable programs V is already mentioned couple of times in the forum, but I...
New
foxtrottwist
A few weeks ago I started using Warp a terminal written in rust. Though in it’s current state of development there are a few caveats (tab...
New
AstonJ
If you want a quick and easy way to block any website on your Mac using Little Snitch simply… File &gt; New Rule: And select Deny, O...
New
New
PragmaticBookshelf
A Ruby-Centric Chat with Noel Rappin @noelrappin Once you start noodling around with Ruby you quickly figure out, as Noel Rappi...
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New

Sub Categories: