Skip to content

Instantly share code, notes, and snippets.

@renatorib
Last active April 11, 2018 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renatorib/8ff677c21aea076c8016f1b9dfbde5c3 to your computer and use it in GitHub Desktop.
Save renatorib/8ff677c21aea076c8016f1b9dfbde5c3 to your computer and use it in GitHub Desktop.
Dan Abramov Q/A at React Brasil Slack (2018/04/11 - 18:00 GMT)

Dan, there are bigger plans to redux this year?

Not sure what you mean 🙂 But I have no plans regarding Redux personally. I'm not actively involved with maintaining it.


Andrew Clark said on his Twitter that class components will be considered as legacy APIs in the future, while function components will remain. We must take this statement in consideration in the projects that are under development/will be developed? And what is the best way to write a component?

He also said on Twitter that we have dozens of thousands of class components and they aren't going anywhere 🙂 When/if we have a more convenient and less verbose way to declare components than classes, we'll definitely announce it, but I don't see how it could affect existing projects.


Tests | We went from 0 to 100 in what regards unit testing. It’s pretty common nowadays to find companies that have very high thresholds on unit testings. Do you think that it’s valuable to impose a high unit test coverage even for presentational components?

Personally I don't find unit testing components very valuable. Especially if they just contain markup — you're basically testing that React works, and we have tests in React itself for that. I think some combination of integration tests for higher-level UI scenarios (click a button, something shows up) and unit tests for logic (e.g. complex calculations) is helpful. I'm more skeptical of asserting on component output although I understand others might not agree.


Styling | What is your opinion of css-in-js? Do you prefer it over standard stylesheets (scss, css-modules, post-css etc) or it’s more interesting to use a css-in-js lib? If so, which one? (styled-components)?

I don't care about this much. If I were writing something today for myself I'd probably use vanilla CSS. Maybe glamor if there were a lot of dynamic styles.


How will async react help in handling requests waterfall?

Not sure what exactly is being asked. But my guess is this is about the case where you have a parent and child component that each request some data, but it could've been requested in parallel. With “suspense” APIs (part of async React), we think it’s much simpler to “move” async dependencies up and down the tree without re-wiring the props or changing the app architecture. This is because all components are backed by the same cache. So I think async React would help avoid waterfalls by making it easier to optimistically preload resources that you think components below will need. Similar to <link rel="preload"> in HTML.


How will async react improve react native?

There's work in progress on revamping React Native architecture to better take advantage of async rendering and solving some existing pain points regarding interop with sync code. I’m not the best person to talk about that though.


What is take on flow/typescript and reason?

I’m personally comfortable with JS + some sprinkles of Flow where I’m not confident what’s going on with types. Not a fan of having to annotate everything. I haven’t tried Reason yet so I don’t know if I’ll like it.


What next after relay modern?

I don’t know, is there something missing in it? My understanding is that the Relay team is happy with performance wins from Modern. We might need to change the React bindings to it to better take advantage of the upcoming React async features, but I don’t know more.


We all know that unit testing is important, but it’s hard to make sure that all cases are being covered in a test suite. Is there any technique you guys use to make sure all test cases/possibilities are being covered besides only trusting in human review?

If this is about components, I’ll reiterate we don’t do that much unit testing of components at Facebook. If this is about React itself, we’re using fuzzy testing in some cases where there are too many possibilities. A fuzz test is like a test that generates some inputs randomly many times, and then asserts some conditions that we expect to always be true. If there’s a regression, we add it to a list of inputs that must always be tested. So that helps refine a fuzz test over time.


How do you balance fast delivery with code quality?

We sacrifice either one or the other depending on what’s more important? 🙂


How did you start working on Facebook? Was invited? How was the process?

I’ve chatted to recruiters a long time ago but they didn’t have any UK positions at the time, and I couldn’t get a US visa (and didn’t want one that much anyway). After about a year I bumped into Jing Chen at React Europe (I think she was on the Relay team at the time, although I’m not sure). She asked if I was interested in interviewing, and mentioned the London office. I said that I am, so she arranged for other speakers to interview me on the next day (so I skipped most of the conference), but it was a regular FB interview process (several interviews).


What do you think about recompose?

Too much indirection.


Do you confirm that the new versions of React 16.3 and beyond is a way to avoid the use of redux 100%?

I don't understand what's being asked. Can you clarify?


If someone is starting Studying React today do you think it still a good idea study redux as well?

I always suggested learning React first before you look at Redux. After you've learned React, I think learning Redux makes sense even if you don't plan to use it. 90% of "learning Redux" isn't about Redux itself. It's about learning to use functional composition and immutability. That would come in handy regardless of whether you plan to use Redux APIs or rediscover the same patterns yourself when you use context API or something similar.


Should we start moving from using HoC’s and start to use render props?

I don't know, what looks clearer to you?


Is React going to add a compilation step soon?

There is already a JSX compilation step but you're probably referring to whole program optimization. There are some experiments we're working on but I wouldn't say there're anywhere near "soon".


How does Facebook handles flow-typed internally?

I don't know.


What about the microservices in front-end with react? It’s a good idea?

I don't know anything about microservices.


Will Facebook switch to fullstack Javascript? Are you guys using nodejs in backend?

No, FB uses a highly optimized runtime and language (HHVM, Hack) and there are no plans to swap it with Node.


What do you think of function as child components?

They're cool when the API is clear?


What are the most important things to check during code reviews?

Semicolons. Okay, I'm kidding. If you don't have any type checker, I think it's most important to look out for potential crashes (null / undefined) as those are painful to diagnose and fix. Other than that, I don't know—depends on the kind of mistakes you usually notice and want to reduce?


How do you feel about ReasonML?

Copy pasting from above:

I haven’t tried Reason yet so I don’t know if I’ll like it.


I’d like to ask you about your first steps into the programming world, what motivated you the most to keep going before you had any palpable success and what would you recommend a junior developer in dedicating himself in 2018?

I started with Visual Basic so that's kind of a long time ago. Throwing things on a form and seeing it "come alive" when I press "run" was pretty magical. I don't think there was anything else that motivated really, I just liked making things. I recommend building lots of small things.


Not much a tech question but, how is the mood inside Facebook about this Cambridge Analytica data breach scandal? Can we expect big changes on the FB developers polices or any chance the open source tools licenses being reveiewed?

The APIs that allowed this "breach" were closed down four years ago. I think at the time the policy was really naïve but there were also a lot of people who argued data should be "more open" and FB is evil for "locking it down". So it's interesting how the perspective changes over a few years. I think it's clear to everybody at the company now that the old vision was too idealistic, but even though they closed it down four years ago, the old mistakes keep chasing them 🙂 . I know there's a lot of people working hard on fixing problems like fake news, election integrity, abuse etc, so I think the company will survive through this and become wiser. I don't see how this relates to open source tools. Regarding developer APIs, yes, there's been some further lockdown on data apps could get, you can read about those changes at https://newsroom.fb.com.


What is your typical day like?

Woke up, fell out of bed Dragged a comb across my head Found my way downstairs and drank a cup And looking up I noticed I was late Found my coat and grabbed my hat Made the bus in seconds flat Made my way upstairs and had a smoke And everybody spoke and I went into a dream


How’s the environment in Facebook HQ? How does it compare to a startup (in terms of bureaucracy, speed, etc)?

I don't really see any bureaucracy at all except cases where something has legal implications. Individual people and teams have a lot of agency.


Do you think that the new versions of React - 16.3.0 and beyond - are going in a direction that will improve state management power to the point where Redux might become useless?

I think I sort of answered that. The point of Redux isn't "Redux-the-library", it's the pattern of separating update logic from descriptions of "what happened". Whether you use Redux-the-library or not, this pattern might be handy for some cases. I wrote an article a long time ago that both describes these cases and describes "Redux without Redux" at the end: https://medium.com/@dan_abramov/you-might-not-need-redux-be46360cf367 I will also quote my earlier reply:

90% of "learning Redux" isn't about Redux itself. It's about learning to use functional composition and immutability. That would come in handy regardless of whether you plan to use Redux APIs or rediscover the same patterns yourself when you use context API or something similar.


What’s your opinion about RxJS?

I think it's cool for handling complex data flows. Not as much a fan of using it for UI composition.


Right now you are working with open-source on your full-time job but how did you manage to work and maintain your personal projects on your free-time? Did you have a limit on how long time you would spend on it?

I didn't work on personal projects that I also wouldn't be using at my main job.


How Facebook structure their frontend code? There is a bunch of microapps? If so how to you make them communicate each other?

No, it's a single monorepo. Any file can import any other file.


Are you using SSR with HHVM? If yes, which tools are you using for?

Not sure what you mean but we don't currently server-render React components. On the server, we use XHP for server rendering (which is not related to React).


Is there any machine learning algorithms to improve frontend code? I heard code splitting is done like that, any other places to apply ML in fronted?

I don't know, but yea, we use it for code splitting.


Do you think Mobx has grown to become a better state handler than Redux? Whats your opinion on that?

Personally I’m not a fan of mutation. 🙂 It’s cool if it solves your problems but it makes some other things that are important to me harder.


What do you think about other forms of DOM manipulation, such as incremental-dom or glimmer?

I think the work glimmer is doing with AOT compilation is interesting. I don't know much about incremental-dom but I don't think DOM is the best fundamental abstraction to build a component system on. (That's my personal opinion)


What is the best solution to work with SSR and Create React App, avoiding the known problem about Google SEO web crawlers?

I don't know. You tell me. 🙂


How async react will improve animations frameworks?

I don't think async React itself is going to help animation libraries. Although it should help block the thread less which should reduce jankiness of the animations when there are other updates happening.


Which other technical fields would you like to work? Robots?

I don't think I have a lot of interest in other technical fields


What is that you think may be big in a few years that only a few people is paying attention right now?

I'm hoping some ideas from async React will become more commonplace in other view libraries


Thoughts on Flutter?

Separating state logic into reusable pieces seems nice. We're thinking about this.


Dan, what do you think about PWA?

I think the premise is good but service workers need better UX


When did you start learning functional programming? Could you recommend any language to get start with?

I think I started with an esoteric language nobody uses (http://nemerle.org/). Doesn't really matter, JS is fine


In the scope of react-native, what do you consider the must-have skills to be considered a good react-native programmer?

I don't know, make apps that look and behave well?


What are the topics you suggest developers - involved with React and its ecosystem - to focus on studying in order to be prepared for the future or next years?

Immutability


Which books changed your life?

https://www.amazon.com/Beginning-Infinity-Explanations-Transform-World/dp/0143121359

@renatorib
Copy link
Author

Bonus:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment