--- title: "React v16.3.0: New lifecycles and context API" author: [bvaughn] --- A few days ago, we [wrote a post about upcoming changes to our legacy lifecycle methods](/blog/2018/03/27/update-on-async-rendering.html), including gradual migration strategies. In React 16.3.0, we are adding a few new lifecycle methods to assist with that migration. We are also introducing new APIs for long requested features: an official context API, a ref forwarding API, and an ergonomic ref API. Read on to learn more about the release. ## Official Context API {#official-context-api} For many years, React has offered an experimental API for context. Although it was a powerful tool, its use was discouraged because of inherent problems in the API, and because we always intended to replace the experimental API with a better one. Version 16.3 introduces a new context API that is more efficient and supports both static type checking and deep updates. > **Note** > > The old context API will keep working for all React 16.x releases, so you will have time to migrate. Here is an example illustrating how you might inject a "theme" using the new context API: `embed:16-3-release-blog-post/context-example.js` [Learn more about the new context API here.](/docs/context.html) ## `createRef` API {#createref-api} Previously, React provided two ways of managing refs: the legacy string ref API and the callback API. Although the string ref API was the more convenient of the two, it had [several downsides](https://github.com/facebook/react/issues/1373) and so our official recommendation was to use the callback form instead. Version 16.3 adds a new option for managing refs that offers the convenience of a string ref without any of the downsides: `embed:16-3-release-blog-post/create-ref-example.js` > **Note:** > > Callback refs will continue to be supported in addition to the new `createRef` API. > > You don't need to replace callback refs in your components. They are slightly more flexible, so they will remain as an advanced feature. [Learn more about the new `createRef` API here.](/docs/refs-and-the-dom.html) ## `forwardRef` API {#forwardref-api} Generally, React components are declarative, but sometimes imperative access to the component instances and the underlying DOM nodes is necessary. This is common for use cases like managing focus, selection, or animations. React provides [refs](/docs/refs-and-the-dom.html) as a way to solve this problem. However, component encapsulation poses some challenges with refs. For example, if you replace a `