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?

Popular Pragmatic Bookshelf topics Top

mikecargal
Title: Hands-On Rust (Chapter 11: prefab) Just played a couple of amulet-less games. With a bit of debugging, I believe that your can_p...
New
lirux
Hi Jamis, I think there’s an issue with a test on chapter 6. I own the ebook, version P1.0 Feb. 2019. This test doesn’t pass for me: ...
New
mikecargal
Title: Hands-on Rust: question about get_component (page 295) (feel free to respond. “You dug you’re own hole… good luck”) I have somet...
New
HarryDeveloper
Hi @venkats, It has been mentioned in the description of ‘Supervisory Job’ title that 2 things as mentioned below result in the same eff...
New
Chrichton
Dear Sophie. I tried to do the “Authorization” exercise and have two questions: When trying to plug in an email-service, I found the ...
New
nicoatridge
Hi, I have just acquired Michael Fazio’s “Kotlin and Android Development” to learn about game programming for Android. I have a game in p...
New
tkhobbes
After some hassle, I was able to finally run bin/setup, now I have started the rails server but I get this error message right when I vis...
New
andreheijstek
After running /bin/setup, the first error was: The foreman' command exists in these Ruby versions: That was easy to fix: gem install fore...
New
a.zampa
@mfazio23 I’m following the indications of the book and arriver ad chapter 10, but the app cannot be compiled due to an error in the Bas...
New
redconfetti
Docker-Machine became part of the Docker Toolbox, which was deprecated in 2020, long after Docker Desktop supported Docker Engine nativel...
New

Other popular topics Top

siddhant3030
I’m thinking of buying a monitor that I can rotate to use as a vertical monitor? Also, I want to know if someone is using it for program...
New
PragmaticBookshelf
Design and develop sophisticated 2D games that are as much fun to make as they are to play. From particle effects and pathfinding to soci...
New
New
Rainer
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New
New
PragmaticBookshelf
Author Spotlight Mike Riley @mriley This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New
New
PragmaticBookshelf
Author Spotlight: Bruce Tate @redrapids Programming languages always emerge out of need, and if that’s not always true, they’re defin...
New
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

Latest in Modern Front-End Development for Rails

Modern Front-End Development for Rails Portal