1. 26
    Configure a React & Redux Application For Production Deployment and Deploy to Now
    6m 27s

Configure a React & Redux Application For Production Deployment and Deploy to Now

InstructorAndy Van Slaars

Share this video with your friends

Send Tweet

In this lesson, we’ll make a few small changes to our scripts and add some environment variables that will be used at build time to get our application ready to be deployed to a production environment using the now service. Once properly configured, we’ll use the now CLI and publish our application to a production server.

tsvika
~ 7 years ago

Great course...But why not separate actions to separate file?

Dan Putnam
~ 7 years ago

I get an error trying to use baseUrl:

src/lib/todoServices.js:5 2 | 3 | export const getTodos = () => { 4 | return fetch(baseUrl)

5 | .then(res => res.json()) 6 | } 7 | 8 | export const createTodo = (name) => {

Andy Van Slaarsinstructor
~ 7 years ago

Great course...But why not separate actions to separate file?

Thanks!

I find that having actions, action creators and reducers in separate files makes it a little more difficult to add or change code because you end up going to several source files to do it.

I also thought this approach would make following along through videos easier, as you don't have to try to keep track of quite as many file changes.

This choice really comes down to personal preference, so you should follow whatever approach works for you and your team.

Paul
~ 7 years ago

Nearly there...

I've managed to authenticate with now.sh, but when attempting to push, I receive the output held at https://gist.github.com/paulspencerwilliams/ab607b740f5b4dfd18cf58b1b1568a3a

Andy Van Slaarsinstructor
~ 7 years ago

Paul,

Looks like a problem with permissions when json-server tries to create the default db.json file. Maybe try putting a db.json file in your build folder with the json predefined as:

{
  todos: []
}

Hope this works for you.

Fabricio
~ 7 years ago

Great course! Thanks a lot Andrew! I was stuck setting the .env variable, I found that any property on these files must be prefixed REACT_APP... in order to be available in the process object.

Paul
~ 7 years ago

I've just tried with empty db.json file as suggested, and with no db.json file, and neither worked with the same error message :-/

Fabricio
~ 7 years ago

Hey Paul,

I've just tried with empty db.json file as suggested, and with no db.json file, and neither worked with the same error message :-/

When you run your npm script to start json-server which user owns the process? It should be you your user.

Ant
~ 7 years ago

This is an exceedingly well structured course, which leads you incrementally through successive designs from first principles to best practice. This gave me a deeper understanding of the concepts and techniques I was previously using in 'idiot savant' mode. Thanks Andrew, good job.

Paul Kamma
~ 7 years ago

Thank you for this course. I also like the approach to keep the reducer and actions in one file.

Andy Van Slaarsinstructor
~ 7 years ago

This is an exceedingly well structured course, which leads you incrementally through successive designs from first principles to best practice. This gave me a deeper understanding of the concepts and techniques I was previously using in 'idiot savant' mode. Thanks Andrew, good job.

Thank you, glad you found it valuable!

Nil Hidalgo
~ 7 years ago

Awesome work. I like the incremental approach followed by the instructor.

Ibrahim Islam
~ 6 years ago

Great course. How would one go about testing a component that is connected to react-redux?

Òscar
~ 6 years ago

After running "now", the deployment shows a directory listing. Don't we need a now.json?

minya
~ 4 years ago

Enviroment variable mapping does not work. Even if I use name starting with REACT_APP.