Intro to React | Upcase

hey @michaelanhari, seems like there was a discussion about it here How to get image paths in JSX? · Issue #211 · reactjs/react-rails · GitHub
Bottom line - it’s not trivial and depends on your setup (whether you’re using sprockets or webpack).
I lean towards passing urls as props to your components because it is in spirit of their functional nature but I can see how that might become very tedious to do all that boilerplate of passing it down from the top component…

Hey @alexvbush, thanks for linking that GitHub issue! :slight_smile: I’m going to give writing react components in es6 a try. My only hesitance is that the company I work for still supports IE10 and I don’t know how well supported es6 when using the rails asset pipeline. Anyone know how well react components written in es6 fair in older browsers?

Also for anyone else that comes across my questions…

The GH issue @alexvbush linked answers #1.

As for as #2 goes, sometimes I use simple_form to generate the html and steal it from there, other times I just hand roll it.

  1. I’ve been passing these in as props and them use them as state if need.

  2. This has become more natural over time… I’ve taken the approach of making a container component that contains several others that are related.

  3. Still haven’t found a vim plugin to handle this, but it would be awesome!

1 Like

This introduction is so informative. I’ve seen a React talk back in its early stages but I had a skeptical mindset for it. I’ll be using it the next time I get the chance to do so. :slight_smile:

1 Like