---
title: "Dan Abramov (@gaearon) | Hashnode"
description: "Dan Abramov (@gaearon) writes on Hashnode. Read their latest articles and follow their work."
url: "https://hashnode.com/@gaearon"
---

@gaearon

# Dan Abramov

@gaearon · Joined January 2016

## Comments

[Hey Ipseeta, thanks for your question. It's a bit hard to single out something in particular since I'm learning every day. But here's a few things, in no particular order: Being in a good team with a good manager is worth more than working on particular projects. Projects come and go, succeed and fail. It's the people you work with who are making these years of your life special, and you can only do your best work when there is an atmosphere of honesty, mutual support and respect. Big rewrites often fail. If you want to replace some old code, you need to have an incremental adoption strategy for it. Blindly rewriting something from scratch in the hope of solving some probems often creates many more of them, especially if you didn't write the original version. Big rewrites can succeed. The previous point is often repeated as a law, but it's not. You can replace a large chunk of code with a complete reimplementation (like we did with React 16) if you have a good integration test suite, and a way to ship the new implementation to a subset of users for a subset of the product surface. We're going to publish a blog post on the Facebook Engineering Blog about this soon. For libraries, tests should ideally be written against the public APIs. This goes against the common mantra of unit testing, but in our experience this helps both ensure that the right thing is being tested, and that it is easy to replace the underlying implementation. It does, however, make debugging test failures harder. For very complex code, fuzz testing may work better than unit tests. If the code you're testing has to handle many unexpected cases that are hard to predict, it might be worth writing tests in a non-deterministic manner that randomly generates inputs and asserts that the outputs satisfy certain conditions. Think about code in time. Don't stop at thinking about the code as it is now. Think about how it evolves. How a pattern you introduce to the codebase might get copy and pasted all over the place. How the code you're spending time prettying up will be deleted anyway. How the hack you added will slow down the team in the long run. How the hack you added will speed up the team in the short term. These are tradeoffs, not rules. We operate on tradeoffs all the time and we must always use our heads. Both clean and dirty code can help or prevent you from reaching your goals. We're not supposed to be super smart. Unless you're building a spaceship, that is. But for normal software development I think it's true. I used to worry when I didn't understand something in the code and thought I was stupid. Now I still think I'm stupid but I know it's not my fault. It means that the code is structured in a weird way, or that the test coverage is not good enough, or that I haven't put console logs in the right place to visualize what's happening. We don't need to know everything. But we need to know when to build tools to advance our understanding, and learn to explore the code we don't understand. Even when it's our own code. Use binary search and scientific method. Not literally in the code, but in how you approach it. Have a bug somewhere between callsites A and B? Put a log in the middle. It's between A and the midpoint? Put another log in the middle. Something's wrong with some input? Eliminate half the input. It's working? Try the other half. Etc. Debugging can feel very arbitrary but it's straightforward when you do it mechanically. Observe, form a hypothesis, come up with a way to test it, repeat. And cut things in half when there are too many. Hope this helps!](https://hashnode.com/forums/thread/what-have-you-learned-after-working-at-facebook-for-almost-two-years-have-you-grown-as-a-developer-and-what-are-some-of-the-key-takeaways/comment/59c14db56873005817ddf507)

Comment · Thread · Sep 19, 2017 · 168 · [What have you learned after working at Facebook for almost two years? Have you grown as a developer and what are some of the key takeaways?](https://hashnode.com/forums/thread/what-have-you-learned-after-working-at-facebook-for-almost-two-years-have-you-grown-as-a-developer-and-what-are-some-of-the-key-takeaways)

[That's a fair point, and I agree with it! We've tried to avoid this kind of problem by: Only focusing on build tooling and not generating any code. So you can drop any router (or any other runtime library) into the project without worrying that it would not match the conventions. Not generating configs. Since configs are hidden, you can’t mess them up. I agree that there are corner cases where the abstraction is leaky, and it's definitely useful to know what underlying tools are used.](https://hashnode.com/forums/thread/would-you-use-create-react-app-for-a-new-project/comment/598c96acf70112c94606b33e#reply-598ecebb266c361e77193a01)

Reply · Thread · Aug 12, 2017 · 2 · [Would you use create-react-app for a new project?](https://hashnode.com/forums/thread/would-you-use-create-react-app-for-a-new-project)

[I'd like to note that Create React App is different from a boilerplate in the general sense. A boilerplate is usually cloned once, and at that point you're left maintaining all the build configuration and dependencies yourself. Create React App, however, leaves you an option to apply upstream updates with a single dependency change, and not maintain the configuration files even as they change internally.](https://hashnode.com/forums/thread/would-you-use-create-react-app-for-a-new-project/comment/598bea83c78395d5493f1fa5#reply-598e2d6afd4e629367c24cd8)

Reply · Thread · Aug 11, 2017 · 7 · [Would you use create-react-app for a new project?](https://hashnode.com/forums/thread/would-you-use-create-react-app-for-a-new-project)

[While I generally agree that it's good to understand how tools work, I do wonder how far you think it is worth going. For example, Webpack uses a JavaScript parser called Acorn. Does one need to understand Acorn (and how parsers work in general) to build a React app? I would say no, although it is useful to some degree. Acorn is on a lower level of abstraction than Webpack. Similarly, Webpack is on a lower level of abstraction than Create React App. The way I see it, you can start from any level of abstraction that helps you be productive. Then you can start peeling back layers, and decide if understanding those is valuable to you or not. For example, understanding Webpack will help you create much more customized setups. But you can go deeper, and understand Acorn to work on support for new syntax proposals in Webpack itself. And so on. I think it's important we don't insist some tools are "real" and some aren't. These are all different levels of abstraction, and as long as they help you solve the problem, they're all good. But I agree there is value in looking at what's beneath them when you have the time and need for that.](https://hashnode.com/forums/thread/would-you-use-create-react-app-for-a-new-project/comment/598c96acf70112c94606b33e#reply-598e2cd4fd4e629367c24ccf)

Reply · Thread · Aug 11, 2017 · 7 · [Would you use create-react-app for a new project?](https://hashnode.com/forums/thread/would-you-use-create-react-app-for-a-new-project)

[I'm obviously biased (as tool creator) but I'd like to point out that copying configs is exactly the problem we wanted to avoid. It is hard to keep them up to date in different projects as tools evolve. You need to know which versions of which tools are compatible. Any time a tool updates, you need to do this work again: figure out migration instructions for each tools, update the configs, find latest stable compatible versions, etc. On the other hand, Create React App gives you a single development dependency that encapsulates multiple tools working together. We ensure that they are compatible, and we do the work of updating the configs for you. In the rare case when there are breaking changes, we enumerate them in a single place with migration instructions. Let me give you an example. Redux repo has a few example apps that are built with Create React App. At the time they embraced CRA, it was using Webpack 1. Then a few months later we released a version of CRA that uses Webpack 2, and adds many nice features (such as runtime error overlay). It was result of months of work from CRA contributors, and internal configs changed considerably, but it only took a few lines of version changes to migrate the Redux example apps to use it! And now we migrated CRA to use Webpack 3 in a patch release. So anyone can safely bump a single package to get all the build speed improvements. But if you used Webpack directly you'd have to watch out for breaking changes, update plugins to compatible versions yourself, etc. I hope this gives some additional perspective for why keeping config separate might be a better idea than copying it into each project. Even if you don't use CRA, I hope you see benefits of this "shared config" approach and can apply it to your own tools.](https://hashnode.com/forums/thread/would-you-use-create-react-app-for-a-new-project/comment/598d4aefc78395d5493f2f73#reply-598e2828266c361e77192cf4)

Reply · Thread · Aug 11, 2017 · 11 · [Would you use create-react-app for a new project?](https://hashnode.com/forums/thread/would-you-use-create-react-app-for-a-new-project)

[First of all, don’t worry about “anti-patterns”, just do what makes sense to you as long as you don’t ship too many bugs. There is a whole industry (educational content, conferences, consulting) revolving around selling “best practices” and cures for “anti-patterns” so my advice is to be chill about them ;-) As for your specific question, it depends. If most of my network requests don’t end up as useful actions changing the state, I wouldn’t use middleware for them, and just do them directly. However if most of them change the state, but a few don’t, I might use middleware for consistency. Don’t worry about “anti-patterns” and use your best judgement.](https://hashnode.com/forums/thread/ask-anything-to-redux/comment/5c45f8c90347fda2566c99ec#reply-5c45f8c90347fda2566c99ed)

Reply · Thread · Sep 20, 2016 · [Ask anything to Redux](https://hashnode.com/forums/thread/ask-anything-to-redux)

[I would add that Immutable also has its own pitfalls. Like when people hope it improves performance but call toJS() before rendering which completely defeats its purpose, as toJS() allocates a ton of objects with different identities every time. Or when people try to set fields on Immutable objects, or try to use it with the spread operator. I would say that if plain objects and arrays work well for you, stick with them. Don't use Immutable just because somebody else does. If you want to introduce it for performance, make sure to measure your changes so that you don't regress by using it incorrectly.](https://hashnode.com/forums/thread/ask-anything-to-redux/comment/5c45f8c90347fda2566c99fb#reply-5c45f8c90347fda2566c99fd)

Reply · Thread · Sep 20, 2016 · [Ask anything to Redux](https://hashnode.com/forums/thread/ask-anything-to-redux)

[Some favorites of mine (some stable, some crazy) https://github.com/yelouafi/redux-sagahttps://github.com/redux-observable/redux-observablehttps://github.com/cerebral/redux-action-treehttps://github.com/philholden/redux-swarmloghttps://github.com/markdalgleish/redux-analyticshttps://github.com/rangle/redux-segmenthttps://github.com/stoeffel/redux-elm-middleware](https://hashnode.com/forums/thread/ask-anything-to-redux/comment/5c45f8c90347fda2566c99f6#reply-5c45f8c90347fda2566c99f7)

Reply · Thread · Sep 20, 2016 · [Ask anything to Redux](https://hashnode.com/forums/thread/ask-anything-to-redux)

[Build an app with React itself. When it's large, you might notice some components get extremely large and buggy. This is a good point to perhaps introduce some Redux into it. Most importantly, learn things as you need them to build an app, don't try to learn everything at once. https://github.com/petehunt/react-howto is a good guide. https://github.com/facebookincubator/create-react-app is a good way to get started.](https://hashnode.com/forums/thread/ask-anything-to-redux/comment/5c45f8c90347fda2566c99ee#reply-5c45f8c90347fda2566c99f0)

Reply · Thread · Sep 20, 2016 · [Ask anything to Redux](https://hashnode.com/forums/thread/ask-anything-to-redux)

[I think React Router v4 preview looks pretty good, and I'd recommend using it when a stable version is out. You can read about it here: https://github.com/reactjs/react-router/tree/v4.](https://hashnode.com/forums/thread/ask-anything-to-redux/comment/5c45f8c90347fda2566c99f8#reply-5c45f8c90347fda2566c99f9)

Reply · Thread · Sep 20, 2016 · [Ask anything to Redux](https://hashnode.com/forums/thread/ask-anything-to-redux)
