Facebook is loading a slew of new tools into its development arsenal. The company announced new developer services and solutions at its annual F8 developer conference this week.
Adding to its React toolbox, the company announced a reimplementation of the JavaScript library core algorithm. React Fiber is designed to improve React’s suitability in areas such as animation, layout and gestures. According to Andrew Clark, a front-end engineer at Facebook, a key feature in React Fiber is its incremental rendering. The feature allows developers to “split rendering work into chunks and spread it out over multiple frames,” according to Clark. In addition, it features the ability to pause, abort or reuse work; assign priority to different updates; and provides new concurrency primitives.
React is also getting a new library for building virtual reality experiences. React VR provides anyone with a JavaScript understanding the tools they need to build and deploy VR experiences. “Those experiences can then be distributed across the web — React VR leverages APIs like WebGL and WebVR to connect immersive headsets with a scene in a web page. And to maximize your potential audience, sites built in React VR are also accessible on mobile phones and PCs, using accelerometers or the cursor for navigation,” Andrew Imm, software engineer at Facebook, wrote in a post.
With React VR, developers can create 3D scenes, build audio and video capabilities, and provide 360-degree content. “React VR continues to drive the mantra of the React ecosystem: Learn once, write anywhere,” Imm wrote.
In addition, Facebook introduced a new version of its JavaScript framework for building data-driven React apps. Relay Modern is designed to make Relay easier to use, more extensible, and enhance mobile device performance. “Our goal with Relay is to allow developers to move fast by focusing more on building their applications and less on re-implementing these complex and error-prone details,” Lee Byron and Joe Savona, Facebook team members, wrote in a post.
According to Byron and Savona, as Relay started to be used on a variety of different devices the team realized some limitations with the design. For instance, the nature of the API made it difficult to achieve a high level of performance. The API also made it hard for developers to learn and predict things.
“Relay Modern retains the best parts of Relay — colocated data and view definitions, declarative data fetching — while also simplifying the API, adding features, improving performance, and reducing the size of the framework,” the team wrote. Relay Modern features two new concepts: static queries and ahead-of-time optimization, and adds simpler mutations and garbage collection.
The company also released a declarative UI framework for Android into open source. According to the team members, building a smooth UI performance on Android is too difficult. As a result, the company developed Litho to provide UI optimizations under the hood while keeping the code maintainable.
“Building on the success we’ve seen with React, we wanted to deliver a simple API for defining user interfaces from declarative components, with performance as the primary goal. We designed the framework to be fast, even for our complex products such as News Feed,” Pasquale Anatriello and Marco Cova, Facebook team members, wrote in a post.
Litho features asynchronous layout, flatter view hierarchies, and fine-grained recycling to define UI components. More information is available here.