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

jimmykiang
This test is broken right out of the box… — FAIL: TestAgent (7.82s) agent_test.go:77: Error Trace: agent_test.go:77 agent_test.go:...
New
yulkin
your book suggests to use Image.toByteData() to convert image to bytes, however I get the following error: "the getter ‘toByteData’ isn’t...
New
New
swlaschin
The book has the same “Problem space/Solution space” diagram on page 18 as is on page 17. The correct Problem/Solution space diagrams ar...
New
jskubick
I’m running Android Studio “Arctic Fox” 2020.3.1 Patch 2, and I’m embarrassed to admit that I only made it to page 8 before running into ...
New
jonmac
The allprojects block listed on page 245 produces the following error when syncing gradle: “org.gradle.api.GradleScriptException: A prob...
New
s2k
Hi all, currently I wonder how the Tailwind colours work (or don’t work). For example, in app/views/layouts/application.html.erb I have...
New
kolossal
Hi, I need some help, I’m new to rust and was learning through your book. but I got stuck at the last stage of distribution. Whenever I t...
New
EdBorn
Title: Agile Web Development with Rails 7: (page 70) I am running windows 11 pro with rails 7.0.3 and ruby 3.1.2p20 (2022-04-12 revision...
New
ggerico
I got this error when executing the plot files on macOS Ventura 13.0.1 with Python 3.10.8 and matplotlib 3.6.1: programming_ML/code/03_...
New

Other popular topics Top

Devtalk
Reading something? Working on something? Planning something? Changing jobs even!? If you’re up for sharing, please let us know what you’...
1033 17461 382
New
AstonJ
If it’s a mechanical keyboard, which switches do you have? Would you recommend it? Why? What will your next keyboard be? Pics always w...
New
Exadra37
On modern versions of macOS, you simply can’t power on your computer, launch a text editor or eBook reader, and write or read, without a ...
New
AstonJ
If you are experiencing Rails console using 100% CPU on your dev machine, then updating your development and test gems might fix the issu...
New
AstonJ
Seems like a lot of people caught it - just wondered whether any of you did? As far as I know I didn’t, but it wouldn’t surprise me if I...
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
AstonJ
Biggest jackpot ever apparently! :upside_down_face: I don’t (usually) gamble/play the lottery, but working on a program to predict the...
New
New
PragmaticBookshelf
Author Spotlight: Karl Stolley @karlstolley Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New
DevotionGeo
I have always used antique keyboards like Cherry MX 1800 or Cherry MX 8100 and almost always have modified the switches in some way, like...
New

Sub Categories: