ReactJs Where to save ~500 image files for MERN app reactjs where to put images,reactjs where to store jwt,

I am building a sports web app, and for the application I need thumbnail images for each NBA basketball player. I have written a script that grabs image paths (links like this - http://a.espncdn.com/combiner/i?img=/i/headshots/nba/players/full/3414.png&w=350&h=254), so I have access to all of the images, but I am not sure what React best-practices are with regards to where to save these types of images. I think my options are:

  1. Save the image files for each player in the app directory (where other images are saved, i think the assets folder of my app), and import them into the app.
  2. Don't save the image files, but rather create a table in my database with player IDs and image paths, and have my app use these paths to grab the already hosted images.
  3. Both A and B essentially. First save the image files, and then re-host the image files myself, and link to these newly hosted images.

Do those 3 choices make sense? i feel like (3) is the best option but also requires the most work. (2) seems like the easiest but least reliable, since I cannot trust that the already-hosted image urls will always work, and (1) just doesn't seem like the best approach, since it would require hundreds of import statements in my app to get all of the images.

Not a coding question, but I think this has a broad applicability and am hoping the post can stay up. Any help or thoughts are appreciated on this!

Edit: for reference, here's something along the lines of what my table looks like:

> player.image.df
      [,1]                [,2]                                                                                       
 [1,] "alex-abrines"      "http://a.espncdn.com/combiner/i?img=/i/headshots/nba/players/full/2995702.png&w=350&h=254"
 [2,] "quincy-acy"        "http://a.espncdn.com/combiner/i?img=/i/headshots/nba/players/full/6576.png&w=350&h=254"   
 [3,] "steven-adams"      "http://a.espncdn.com/combiner/i?img=/i/headshots/nba/players/full/2991235.png&w=350&h=254"
 [4,] "bam-adebayo"       "http://a.espncdn.com/combiner/i?img=/i/headshots/nba/players/full/4066261.png&w=350&h=254"
 [5,] "arron-afflalo"     "http://a.espncdn.com/combiner/i?img=/i/headshots/nba/players/full/3187.png&w=350&h=254"   
 [6,] "alexis-ajinca"     "http://a.espncdn.com/combiner/i?img=/i/headshots/nba/players/full/3410.png&w=350&h=254"   
 [7,] "cole-aldrich"      "http://a.espncdn.com/combiner/i?img=/i/headshots/nba/players/full/4267.png&w=350&h=254"   
 [8,] "lamarcus-aldridge" "http://a.espncdn.com/combiner/i?img=/i/headshots/nba/players/full/2983.png&w=350&h=254"   
 [9,] "jarrett-allen"     "http://a.espncdn.com/combiner/i?img=/i/headshots/nba/players/full/4066328.png&w=350&h=254"
[10,] "kadeem-allen"      "http://a.espncdn.com/combiner/i?img=/i/headshots/nba/players/full/3134880.png&w=350&h=254"

These aren't my links, and I have no way to know if ESPN ever changes these links, which is why I think (3) is the best approach here. But I'm not sure how to host my own images quickly and easily.

Answer:1



  1. reactjs where to put images
  2. reactjs where to store jwt
  3. reactjs where to store token
  4. reactjs where to store images
  5. reactjs where to put api calls
  6. reactjs where to put business logic
  7. reactjs where to fetch data
  8. reactjs where to put css

fairly new to react.js, but prototyping a concept and getting stuck. I want to have a component that delivers a variable name back (that it gets from an API), then based on that name, import a bunch ...

fairly new to react.js, but prototyping a concept and getting stuck. I want to have a component that delivers a variable name back (that it gets from an API), then based on that name, import a bunch ...

I want to use leader-line in my React web project. It is an external javascript library, but I don't know how to integrate it into the project with the JSX syntax. For example, its documentation tells ...

I want to use leader-line in my React web project. It is an external javascript library, but I don't know how to integrate it into the project with the JSX syntax. For example, its documentation tells ...