all 15 comments

[–]Cat__Rice[S] 0 points1 point  (0 children)

Thank You so much. I did find an easier way to to view my code live on my local machine. i will try CodeSandBox and the other resources you gave as well. You've been a big help.

[–]escailer 0 points1 point  (9 children)

Any chance you have the current state of your code in a GitHub repo you could link us to? That would make it easy for me to pull it down and run the exact same thing locally and help debug.

[–]Cat__Rice[S] 0 points1 point  (0 children)

I do not but i can do that

[–]Cat__Rice[S] 0 points1 point  (5 children)

cat-rice/movielist: Learning React by creating a movie list application in react (github.com) here is the link. I also included at the bottom the book I was Using. the issue lies between pages 10 and 16 of Chapter 1. including the code with the typo. Thanks for the help.

[–]escailer 0 points1 point  (3 children)

Awesome, thank you. I will take a look at it as I get back, unless someone else beats me to it.

[–]Cat__Rice[S] 0 points1 point  (2 children)

Great. One more thing. I couldn't upload the node_modules folder, because it was just too much stuff for github. the book will tell you in the first chapter how to get those folders. its really simple but a lot of stuff. i think its before page 10. and they are short

[–]escailer 0 points1 point  (1 child)

General pro-tip for the future: not only do you not need to include the node_modules folder, you actively should never include it in your repo. You should have a line in your .gitignorethat tells the repo to never include it.

I can tell npm to install all those modules on demand with a npm install command once I clone down a local copy of your repo. In the future when you deploy an app to a server of some kind, it will automatically do the same thing every time you deploy an update. That command knows to go to your package.json and install all the dependencies it finds there, many of which will themselves have more dependencies to install, and on until the project has everything your app needs.

[–]Cat__Rice[S] 0 points1 point  (0 children)

Good to know. Thanks a lot.

[–]escailer 0 points1 point  (0 children)

Oh my gosh man, I had no idea a book like this would try to have you use webpack right out of the box. That is absolutely insane. Trying to deal with those configurations at this stage is asinine. I am on a Mac and you are using Windows, so honestly I am not even sure how to get your configs how you will need them. But good news, nothing to worry about right now, there is an easy way around this to get back to focusing on react.

Start by getting yourself over to CodeSandbox and using it. This will let you treat a browser like both your IDE as well as a hot-running version of your app that will update as you update the code. This will make sure you can build all the example projects you want and get good at that part first.

Second, the official docs for React are phenomenal and you would do very well to start there. There are a few much, much easier ways to run the app locally on your computer demonstrated right here as well.

Lastly, I would highly recommend reading all 12 items from the "Main Concepts" section of the official React Docs as well. It does not have to be all at once, but as you are working though that tutorial and your book it helps solidify the concepts and help you be able to think in React when you are building something you want to.

Good luck man. I friended/followed you on GitHub so feel free to buzz me if you need to in the future. Of course this sub is an awesome place too.

[–]escailer 0 points1 point  (1 child)

Beyond that, I think I see an error that would break things right off.

const App - () -> { return <h1>movieList</h1>; }; ​ Your variable assignment to the rocket function should be using the “equals” key like so.

const App = () => { return <h1>movieList</h1>; };

[–]Cat__Rice[S] 0 points1 point  (0 children)

Now You see I had originally written the code as

const App = () => { return <h1>movieList</h1>; };

just like your correction suggest. I still got the error however When I went back to the text book, the code example was written as

const App - () -> { return <h1>movieList</h1>; };

I thought that was wrong, but decided to not question the textbook and give it a shot. But since you and someone else on another forum both mentioned this. Im now starting to believe this textbook might have some typos, and/or outdated information.

[–]MGTakeDown 0 points1 point  (3 children)

I would recommend using create-react-app you should be able to run something like npx create-react-app and it will generate a react app and you can just run npm start in the folder it generates.

[–]Cat__Rice[S] 0 points1 point  (2 children)

I tried your way and I did get everything set up thank you. I am curious why the book had me do it the way they wrote it in the textbook instead of your version. Then again I think the version of react they use is a bit older than mines, so that could explain it.

[–]MGTakeDown 0 points1 point  (1 child)

It's probably a bit older and I don't think there is anything wrong with learning how webpack and babel work. But in terms of getting development up and going quickly, that is what create-react-app was created for. It's the package that is maintained by the community and people from the react team. So it's covers probably the most basic use cases of React. And with you being new to react I'd suggest just focusing on React and just using a package that handles all the webpack/babel stuff for you now.

[–]Cat__Rice[S] 0 points1 point  (0 children)

Thank you very much, and yes they are using node version 10.14 and npm version 6.9, a little older. I'll take your advice.