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.
Great course...But why not separate actions to separate file?
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) => {
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.
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
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.
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.
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 :-/
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.
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 for this course. I also like the approach to keep the reducer and actions in one file.
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!
Awesome work. I like the incremental approach followed by the instructor.
Great course. How would one go about testing a component that is connected to react-redux?
After running "now", the deployment shows a directory listing. Don't we need a now.json?
Enviroment variable mapping does not work. Even if I use name starting with REACT_APP.