Skip to content

Instantly share code, notes, and snippets.

@wuweiweiwu
Last active May 17, 2018 20:05
Show Gist options
  • Save wuweiweiwu/ed0d5e8b1a7462abfccbf1ea713bd841 to your computer and use it in GitHub Desktop.
Save wuweiweiwu/ed0d5e8b1a7462abfccbf1ea713bd841 to your computer and use it in GitHub Desktop.
Takeaways from Facebook F8 2018

Sessions

Keynote Day 1 - Mark Zuckerberg talks about data privacy and our responsibility as developers.

Type-Checked Python at Instagram - static typing using mypy (maintained by Dropbox) and how we can eliminate possible test cases so we can focus on tests with high granularity. Gradual typing of large codebases. Using MonkeyType to use runtime analysis to generate possible static types (e.g using tests).

How React Native Helps Companies Build Better Mobile Apps - Panel including Sophie Alpert, Engineering Manager for the React team. Reduce code duplication in codebases (iOS + Android). Learn once, write anywhere. Developers who have experience using React or React Native can easily pick up the other.

Other topics

Typing in JavaScript

Flow v. TypeScript

(I am also very biased and love Flow, but if you haven't you should try both and decide for yourself)

  • Regardless of your personal opinions, using a static type checker will make your code safer and easier to test.
  • https://github.com/niieani/typescript-vs-flowtype
  • https://medium.com/the-web-tub/comparing-flow-with-typescript-6a8ff7fd4cbb
  • https://discuss.reactjs.org/t/if-typescript-is-so-great-how-come-all-notable-reactjs-projects-use-babel/4887/2
  • Structural typing and/or nominal typing - Flow uses structural typing for objects and functions, but nominal typing for classes. Whereas Typescript uses structural typing. (ex: 2 React classes with different names and a render(): Node method would be the same in the eyes of Typescript but not the same in Flow).
  • Not as good community support in Flow v. Typescript.
  • Flow has better integration with React and its ecosystem.
  • Flow can be easily be integrated into existing projects without causing disruptions into the build process. Especially if you're already on Babel.
  • Typescript purposely does not attempt to be a sound type system: "Non-Goals: […] Apply a sound or “provably correct” type system. Instead, strike a balance between correctness and productivity." - TypeScript Design Goals. "soundness" means that the type checker will always complain when your program is invalid.
  • Flow's type inference is amazing. Uses "flow analysis" - pretty much you can infer type incompatibilities with very little type information.

PropType runtime analysis in React

  • using prop-types package to analysis data input into React components (props)

Performance in React

  • Windowing - when rendering a large number of items (e.g: a list of 1 million contacts) your page is going to die. Windowing is the idea that you only render things that you see. I would encourage checking out react-virtualized which is a component set that implements windowing that I maintain alongside a React core team member. I would checkout his talk at ForwardJS SF.
  • JavaScript death by a thousand cuts
  • "shouldComponentUpdate" or "PureComponent" - by default React re-renders every time props or state changes.
  • Using predictable component keys in lists to boost performance. Keys help React identify which items have changes.
  • React 16.x async rendering - currently the React team is preparing the ecosystem for a future release of async rendering. Which included the deprecation of some lifecycle functions as unsafe (componentWillReceiveProps, componentWillUpdate, componentWillMount) in favor of (static getDerivedStateFromProps, getSnapshotFromUpdate)

Open Source and why we should participate

  • Open source projects and how we can give back to the community by contributing to existing projects and/or new projects that will benefit other developers. (ex: dq, qstrap). This can mean financially supporting non-profits that contribute to the open source ecosystem or just making projects that we use regularly more robust.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment