You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on @mikberg’s [blog post](https://medium.com/@mikaelberg/writing-simple-unit-tests-with-relay-707f19e90129).
96
-
97
-
#### 1. Mock out Relay
98
-
99
-
You’ll need the content from [this Gist](https://gist.github.com/mikberg/07b4006e22aacf31ffe6) for your mocked-out Relay replacement.
95
+
**First, mock out Relay.** You’ll need the content from [this Gist](https://gist.github.com/mikberg/07b4006e22aacf31ffe6) for your mocked-out Relay replacement.
100
96
101
97
```js
102
98
// styleguide.config.js
@@ -120,9 +116,7 @@ import Relay from 'real-react-relay';
120
116
// Copy contents from https://gist.github.com/mikberg/07b4006e22aacf31ffe6
121
117
```
122
118
123
-
#### 2. Provide sample data to your React components
124
-
125
-
You’ll probably want to massage actual results from your GraphQL backend, and make it available to the examples:
119
+
**Second, provide sample data to your React components** to be able to message actual results from your GraphQL backend:
126
120
127
121
```js
128
122
// styleguide.config.js
@@ -148,7 +142,10 @@ module.exports = {
148
142
<MyComponent object={sample.object} />
149
143
```
150
144
151
-
## How to use React Styleguidist with Styled Components?
145
+
*Based on @mikberg’s [blog post](https://medium.com/@mikaelberg/writing-simple-unit-tests-with-relay-707f19e90129).*
146
+
147
+
148
+
### Styled Components
152
149
153
150
The [recommended way](https://github.com/styleguidist/react-styleguidist/issues/37#issuecomment-263502454) of using [Styled Components](https://styled-components.com/) is like this:
0 commit comments