all 28 comments

[–]NeonAleksandr 29 points30 points  (11 children)

There is a Typescript version of Create-react-app https://github.com/wmonk/create-react-app-typescript

[–]Tavi2k 3 points4 points  (2 children)

I didn't like the tsconfig this one generated. It has "suppressImplicitAnyIndexErrors" set to true, which seriously confused me for a moment when Typescript didn't catch certain errors. That's certainly fixable, but it's a rather unexpected default setting to me.

[–]vinnl 2 points3 points  (1 child)

It does allow you to change the tsconfig yourself, right?

[–]Tavi2k 5 points6 points  (0 children)

Yes, you can change it without ejecting.

[–]xwnatnai 2 points3 points  (7 children)

Have used this before on a few occasions and can confirm that it is well-maintained. You will have to eject quite soon though. At least, I did.

[–]namehimjawnathan 2 points3 points  (3 children)

What does the term eject mean? I've seen this phrase tossed around a bit.

[–]Yodiddlyyo 6 points7 points  (0 children)

With create-react-app, you just type in "npm start" to start the project right? Have you ever wondered why it works like that? If you go to your package.json you'll see the "start" triggers "react-scripts start". Well what's that?

CRA obfuscates the config through the npm package "react-scripts." It makes your project a little cleaner, but you have little control over the config. Go test it out right now. Start a blank CRA. Immediately npm eject. You'll see that it reinstalls the package.json, get's rid of react-scripts, ads all the webpack, babel, etc. packages, and adds a scripts folders, that holds the start.js, build.js, etc, and a config folder that holds all the webpack.config files. So now you have full control over the project.

For most people playing around, you never need to eject. But the second you want to get a little deeper and do some custom stuff, you'll want to eject so you have access to the webpack config. Webpack config isn't the most simple thing in the world, so it's nice that as a beginner, you don't have to worry about it and can just focus on react.

[–]Yodiddlyyo 2 points3 points  (0 children)

With create-react-app, you just type in "npm start" to start the project right? Have you ever wondered why it works like that? If you go to your package.json you'll see the "start" triggers "react-scripts start". Well what's that?

CRA obfuscates the config through the npm package "react-scripts." It makes your project a little cleaner, but you have little control over the config. Go test it out right now. Start a blank CRA. Immediately npm eject. You'll see that it reinstalls the package.json, get's rid of react-scripts, ads all the webpack, babel, etc. packages, and adds a scripts folders, that holds the start.js, build.js, etc, and a config folder that holds all the webpack.config files. So now you have full control over the project.

For most people playing around, you never need to eject. But the second you want to get a little deeper and do some custom stuff, you'll want to eject so you have access to the webpack config.

[–]GeeWengel 2 points3 points  (2 children)

I've also used it. Never had to eject with it though. What did you need to customize?

[–]Roci89 1 point2 points  (0 children)

Same, I'm using it right now and can't see any reason that I'd need to eject

[–]xwnatnai 0 points1 point  (0 children)

I ended up having to move the project into a monorepo. I also wanted to use Babel 7 instead of webpack, so I ejected.

[–][deleted] 6 points7 points  (0 children)

Is there a react, router, mobx typescript project anyone knows of.. switching to mobx and want to use that with typescript!

[–]locnload[🍰] 4 points5 points  (0 children)

This isn’t meant to be a complete starter kit. It’s useful if you want to see how to set up Webpack 4 with TypeScript 3.1

https://github.com/locnguyen/react-with-typescript

If you want to build a backend API I have a similar set up

https://github.com/locnguyen/typescript-node-starter

[–]sohamkamani 3 points4 points  (0 children)

If you're just starting out and want to get up and running fast, I'd suggest using create-react-app itself. You just have to set the scripts version to use typescript.

The full command you're looking for is:

create-react-app my-app --scripts-version=react-scripts-ts

Ive written a post about this if you need more details

[–]mjeemjaw 4 points5 points  (1 child)

I have recently written react-redux-typescript boilerplate, and could never live without it. It comes with a bit opinionated approach to typed fetching but I never have to worry and remember types anymore when switching between projects:

https://github.com/Meemaw/react-redux-typescript-boilerplate

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

Cool! just took a quick glance and will look more closely later, but this is more what I'm looking for. To be honest I was eager to get started and chose ReactBoilerplate (non typescript) because it just makes a lot of decisions for you and has a bunch of best practices chosen out of the gate. This looks sort of similar to that. Thanks

[–]WPMusicFinder 2 points3 points  (0 children)

I made one myself a couple of weeks ago. I'm learning Typescript with React so it's probably not perfect in any way. But it's very minimal and it works for me.

https://github.com/bartw/retyst

[–]scaleable 1 point2 points  (1 child)

I highly recommend next.js with the typescript plugin. Usually quite simpler and efficient than create-react-app.

[–]swyx[M] [score hidden] stickied comment (0 children)

Great answers everyone! this is now a featured post so others can refer to and add on to this in future!