React’s ⚛️ new Context API – DailyJS – Medium

React’s ⚛️ new Context API   #reactjs

  • Here’s the simplest useful example I can come up with: – Here’s an even simpler version so you don’t have to open the codesandbox: – const ThemeContext = ThemeProvider extends React.Component { – state = {theme: ‘light’} – render() { – return ( – ThemeContext.Provider value={this.state.theme} – {this.props.children} – /ThemeContext.Provider…
  • , but if that’s not your jam, you could easily implement a Higher Order Component or something else using the context API (which is why it’s the best).
  • The React team will remove the warning about context being an experimental feature because it’s now a “first-class featureâ€� of the framework.
  • Here’s an example: – const ThemeContext = ThemeProvider extends React.Component {/* code */} – const ThemeConsumer = ThemeContext.Consumer – const LanguageContext = LanguageProvider extends React.Component {/* code */} – const LanguageConsumer = AppProviders({children}) { – return ( – LanguageProvider – ThemeProvider – {children} – /ThemeProvider – /LanguageProvider – ) -…
  • react-fns: Browser API’s turned into declarative React components and HoC’s by Jared Palmer ğŸ‘�react-composer: Compose render prop components (what I use in the codesandbox above) by jmeasreact-contextual: Tiny helper around Reacts new context API by Paul HenschelSome tweets from this last week: – P.S.

It’s way more ergonomic, it’s no longer “experimental,” and it’s now a first-class API! OH, AND IT USES A RENDER PROP! NOTE: This is a cross-post from my newsletter. I publish each email to my blog…
Continue reading “React’s ⚛️ new Context API – DailyJS – Medium”

React’s new Context API

React's new Context API  #React  #reactjs

  • The provider component puts the data into context, and the Higher Order Component pulls the data out of context.
  • So in reality, redux isn’t allowing your data to be accessible anywhere… context is!
  • The first pull request to that repository is from Andrew Clark (react core team member) and it’s called “New version of context”.
  • The React team will remove the warning about context being an experimental feature because it’s now a “first-class feature” of the framework.
  • One question that I’ve seen a lot about the new context API (or the render prop pattern in general) is how to compose providers and consumers together.

Continue reading “React’s new Context API”

React’s ⚛️ new Context API

  • The provider component puts the data into context, and the Higher Order Component pulls the data out of context.
  • The first pull request to that repository is from Andrew Clark (react core team member) and it’s called “New version of context”.
  • , but if that’s not your jam, you could easily implement a Higher Order Component or something else using the context API (which is why it’s the best).
  • The React team will remove the warning about context being an experimental feature because it’s now a “first-class feature” of the framework.
  • One question that I’ve seen a lot about the new context API (or the render prop pattern in general) is how to compose providers and consumers together.

React’s new context API way more ergonomic, it’s no longer “experimental,” and it’s now a first-class API! OH, AND IT USES A RENDER PROP!
Continue reading “React’s ⚛️ new Context API”

React’s ⚛️ new Context API – DailyJS – Medium

  • Here’s the simplest useful example I can come up with:Here’s an even simpler version so you don’t have to open the codesandbox:const ThemeContext = ThemeProvider extends React.Component { state = {theme: ‘light’} render() { return ( ThemeContext.Provider value={this.state.theme} {this.props.children} /ThemeContext.Provider ) }}class App extends React.Component { render() { ThemeProvider ThemeContext.Consumer…
  • The React team will remove the warning about context being an experimental feature because it’s now a “first-class feature” of the framework.
  • But even when we do feel it, we’ll have a solid, core React API to lean on to help us avoid the problem.Practical ContextOne question that I’ve seen a lot about the new context API (or the render prop pattern in general) is how to compose providers and consumers together….
  • Here’s an example:const ThemeContext = ThemeProvider extends React.Component {/* code */}const ThemeConsumer = ThemeContext.Consumerconst LanguageContext = React.createContext(‘en’)class LanguageProvider extends React.Component {/* code */}const LanguageConsumer = AppProviders({children}) { return ( LanguageProvider ThemeProvider {children} /ThemeProvider /LanguageProvider )}function { return ( LanguageConsumer {language = ( ThemeConsumer {theme = children({language, theme})} /ThemeConsumer )} /LanguageConsumer…
  • react-fns: Browser API’s turned into declarative React components and HoC’s by Jared Palmer 👏react-composer: Compose render prop components (what I use in the codesandbox above) by jmeasreact-contextual: Tiny helper around Reacts new context API by Paul HenschelSome tweets from this last week:P.

It’s way more ergonomic, it’s no longer “experimental,” and it’s now a first-class API! OH, AND IT USES A RENDER PROP! NOTE: This is a cross-post from my newsletter. I publish each email to my blog…
Continue reading “React’s ⚛️ new Context API – DailyJS – Medium”

Introducing the React RFC Process

  • We’re adopting an RFC (“request for comments”) process for contributing ideas to React.
  • It’s also intended to provide a clear path for ideas to enter the project: – – RFCs are accepted when they are approved for implementation in React.
  • As a rule of thumb, this means any proposal that adds, changes, or removes a React API.
  • We now have several repositories where you can submit contributions to React: – – Coinciding with the launch of our RFC process, we’ve submitted a proposal for a new version of context.
  • The proposal has already received many valuable comments from the community that we will incorporate into the design of the new API.

Inspired by Yarn, Ember, and Rust, the goal is to allow React core team members and community members to collaborate on the design of new features. It’s also intended to provide a clear path for ideas to enter the project:
Continue reading “Introducing the React RFC Process”

The new GitHub GraphQL API – Building Apollo – Medium

  • If you sign their prerelease agreement, you get early access to the GitHub GraphQL API.
  • Where REST requires many requests, GraphQL takes just one
  • If you don’t know what GraphQL is, go check out the excellent introduction on graphql.org before reading the rest of this post.
  • I could have used GraphiQL to explore the schema, but it’s not the easiest way to get a quick overview, so I turned to the API documentation to find out what queries or mutations I could make.
  • My first comment made via GitHub’s GraphQL API

What every developer needs to know about GitHub’s new API
Continue reading “The new GitHub GraphQL API – Building Apollo – Medium”

Invoke Any Native API Directly From Pure Javascript in React Native — Medium

  • Overall, the React Native team did a great job wrapping the basic native components you need.
  • Since the entire specification is now serializable, we can send it over the React Native bridge to the native side.
  • Because adding native code to an already existing native wrapper is an ugly task.
  • Using the technique introduced in this library, you can access any native API directly from Javascript without wrapping it first.
  • Assuming the native return value is serializable, we’ll send it back over the React Native bridge and consume it in Javascript.

Read the full article, click here.


@koltal: “Invoke Any Native API Directly From Pure Javascript in #ReactNative @WixEng @reactnative”


The native iOS SDK has over 15,000 API’s. React Native provides access to a tiny fraction. Wouldn’t it be fun to access all of them from…


Invoke Any Native API Directly From Pure Javascript in React Native — Medium