Skip to content

Commit

Permalink
docs(context-mixins): fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
alavkx committed Nov 12, 2019
1 parent 73a064f commit cd2ce5d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions docs/context-mixins.md
Expand Up @@ -51,19 +51,17 @@ Binding to a Context defined in a JS file holds no surprises.

```js
/** ComponentThatDefinesTheContext.re */
export const JwtContext = React.createContext("light");
export const ThemeContext = React.createContext("light");
```

```reason
/** ComponentToConsumeTheContext.re */
module JwtContext = {
[@bs.module "ComponentThatDefinesTheContext"]
external make: React.Context.t('context) = "JwtContext";
};
[@bs.module "ComponentThatDefinesTheContext"]
external themeContext: React.Context.t('context) = "ThemeContext";
[@react.component]
let make = () => {
let theme = React.useContext(ThemeContext.make);
let theme = React.useContext(themeContext);
<h1>theme->React.string</h1>
}
Expand Down

0 comments on commit cd2ce5d

Please sign in to comment.