Skip to content

Commit b193d22

Browse files
authored
Merge pull request #187 from taion/README-syntax-highlighting
Revert to npm-friendly syntax highlighting [ci skip]
2 parents 5ee892f + 5a8be53 commit b193d22

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
Apply the `useRelay` router middleware, pass in a Relay environment to `<Router>`, then define Relay queries and render callbacks for each of your routes:
99

10-
```jsx
10+
```js
1111
import useRelay from 'react-router-relay';
1212

1313
/* ... */
@@ -67,7 +67,7 @@ $ npm install react-router-relay
6767

6868
Apply the `useRelay` router middleware, and pass in a Relay environment to the `<Router>`:
6969

70-
```jsx
70+
```js
7171
import useRelay from 'react-router-relay';
7272

7373
/* ... */
@@ -89,7 +89,7 @@ ReactDOM.render(
8989

9090
For each of your routes that requires data from Relay, define a `queries` prop on the `<Route>`. These should be just like the queries on a Relay query config:
9191

92-
```jsx
92+
```js
9393
const ViewerQueries = {
9494
viewer: () => Relay.QL`query { viewer }`
9595
};
@@ -109,7 +109,7 @@ If your route doesn't have any dependencies on Relay data, just don't declare `q
109109

110110
If your route's Relay data dependencies are a function of the location or of the parameters, you can define a `getQueries` function on your route that returns the computed queries as a function of the current router state:
111111

112-
```jsx
112+
```js
113113
<Route
114114
component={Widget}
115115
getQueries={({ location, params }) => getWidgetQueries(location, params)}
@@ -120,7 +120,7 @@ If your route's Relay data dependencies are a function of the location or of the
120120

121121
Any path parameters for routes with queries and their ancestors will be used as parameters on the Relay query config:
122122

123-
```jsx
123+
```js
124124
const WidgetQueries = {
125125
widget: () => Relay.QL`
126126
query {
@@ -157,7 +157,7 @@ The `prepareParams` method has the same signature and behavior as `prepareParams
157157

158158
Additionally, you can use route parameters as variables on your containers:
159159

160-
```jsx
160+
```js
161161
const WidgetList = Relay.createContainer(/* ... */, {
162162
initialVariables: {
163163
color: null,
@@ -207,7 +207,7 @@ const widgetListRoute = (
207207

208208
For routes with named components, define `queries` as an object with the queries for each component by name:
209209

210-
```jsx
210+
```js
211211
<Route
212212
components={{ foo: FooComponent, bar: BarComponent }}
213213
queries={{ foo: FooQueries, bar: BarQueries }}
@@ -218,7 +218,7 @@ For routes with named components, define `queries` as an object with the queries
218218

219219
You can pass in a custom `render` callback to your routes:
220220

221-
```jsx
221+
```js
222222
<Route
223223
component={WidgetList}
224224
queries={ViewerQueries}
@@ -232,7 +232,7 @@ While transitioning, the ready state properties (`done`, `error`, `retry`, `stal
232232

233233
The argument object to the render callback includes two extra properties: `routerProps` and `element`. `routerProps` contains the props from the router, and unlike `props`, will be populated regardless of the Relay ready state. `routerProps` can be used to render child routes while the data for the parent route are still loading, or to otherwise use information from the router to control rendering before the Relay data are available. `element` contains the base route element without the props from Relay, and can be used to render the route component when the route uses a dynamic component, or when using other router middlewares that may wrap the route component:
234234

235-
```jsx
235+
```js
236236
({ props, routerProps, element }) => {
237237
if (!props) {
238238
return <Loading {...routerProps} />;
@@ -244,7 +244,7 @@ The argument object to the render callback includes two extra properties: `route
244244

245245
When using named components, you can define these on a per-component basis, optionally omitting the callback for components that do not need a custom render callback:
246246

247-
```jsx
247+
```js
248248
<Route
249249
components={{ foo: FooComponent, bar: BarComponent }}
250250
queries={{ foo: FooQueries, bar: BarQueries }}
@@ -256,7 +256,7 @@ When using named components, you can define these on a per-component basis, opti
256256

257257
We pass through additional props on `<Router>` or the generated router context to the underlying `Relay.Renderer`. You can use this to control props like `forceFetch` on the `Relay.Renderer`:
258258

259-
```jsx
259+
```js
260260
<Router
261261
history={history}
262262
routes={routes}

0 commit comments

Comments
 (0)