mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-28 00:17:12 +01:00
docs: add syntax highlighting to react-sdk
This commit is contained in:
parent
0b3c4fd613
commit
c4035353a0
@ -15,7 +15,7 @@ yarn add @unleash/proxy-client-react
|
|||||||
|
|
||||||
Import the provider like this in your entrypoint file (typically index.js/ts):
|
Import the provider like this in your entrypoint file (typically index.js/ts):
|
||||||
|
|
||||||
```
|
```js
|
||||||
import FlagProvider from '@unleash/proxy-client-react';
|
import FlagProvider from '@unleash/proxy-client-react';
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
@ -38,7 +38,7 @@ ReactDOM.render(
|
|||||||
|
|
||||||
To check if a feature is enabled:
|
To check if a feature is enabled:
|
||||||
|
|
||||||
```
|
```js
|
||||||
import { useFlag } from '@unleash/proxy-client-react';
|
import { useFlag } from '@unleash/proxy-client-react';
|
||||||
|
|
||||||
const TestComponent = () => {
|
const TestComponent = () => {
|
||||||
@ -55,7 +55,7 @@ export default TestComponent;
|
|||||||
|
|
||||||
To check variants:
|
To check variants:
|
||||||
|
|
||||||
```
|
```js
|
||||||
import { useVariant } from '@unleash/proxy-client-react';
|
import { useVariant } from '@unleash/proxy-client-react';
|
||||||
|
|
||||||
const TestComponent = () => {
|
const TestComponent = () => {
|
||||||
@ -76,7 +76,7 @@ export default TestComponent;
|
|||||||
|
|
||||||
Follow the following steps in order to update the unleash context:
|
Follow the following steps in order to update the unleash context:
|
||||||
|
|
||||||
```
|
```js
|
||||||
import { useUnleashContext, useFlag } from '@unleash/proxy-client-react'
|
import { useUnleashContext, useFlag } from '@unleash/proxy-client-react'
|
||||||
|
|
||||||
const MyComponent = ({ userId }) => {
|
const MyComponent = ({ userId }) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user