Skip to content

Commit 0c57dbd

Browse files
lex111rokibulislaamjamesbaskervillefransayconbobziroll
authored
Sync with reactjs.org @ 8112446 (#414)
Sync with reactjs.org @ 8112446 Co-authored-by: Rokibul Islam <[email protected]> Co-authored-by: James Baskerville <[email protected]> Co-authored-by: Franrey Anthony S. Saycon <[email protected]> Co-authored-by: Bob Ziroll <[email protected]> Co-authored-by: Saurabh Daware <[email protected]> Co-authored-by: Jimmy Cleveland <[email protected]> Co-authored-by: Phil Marshall <[email protected]> Co-authored-by: Brian Vaughn <[email protected]> Co-authored-by: Ravi Prakash <[email protected]> Co-authored-by: Thalyta Fabrine <[email protected]> Co-authored-by: Nick Tishkevich <[email protected]>
2 parents bb01501 + fa05eca commit 0c57dbd

File tree

13 files changed

+74
-3
lines changed

13 files changed

+74
-3
lines changed

content/blog/2018-11-27-react-16-roadmap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ function App() {
175175
// provide Suspense integrations with similar APIs.
176176
```
177177

178-
There is no official documentation for how to fetch data with Suspense yet, but you can find some early information in [this talk](https://youtu.be/ByBPyMBTzM0?t=1312) and [this small demo](https://github.com/facebook/react/tree/master/fixtures/unstable-async/suspense). We'll write documentation for React Cache (and how to write your own Suspense-compatible library) closer to this React release, but if you're curious, you can find its very early source code [here](https://github.com/facebook/react/blob/master/packages/react-cache/src/ReactCache.js).
178+
There is no official documentation for how to fetch data with Suspense yet, but you can find some early information in [this talk](https://youtu.be/ByBPyMBTzM0?t=1312) and [this small demo](https://github.com/facebook/react/blob/master/packages/react-devtools/CHANGELOG.md#suspense-toggle). We'll write documentation for React Cache (and how to write your own Suspense-compatible library) closer to this React release, but if you're curious, you can find its very early source code [here](https://github.com/facebook/react/blob/master/packages/react-cache/src/ReactCache.js).
179179

180180
The low-level Suspense mechanism (suspending rendering and showing a fallback) is expected to be stable even in React 16.6. We've used it for code splitting in production for months. However, the higher-level APIs for data fetching are very unstable. React Cache is rapidly changing, and will change at least a few more times. There are some low-level APIs that are [missing](https://github.com/reactjs/rfcs/pull/89) for a good higher-level API to be possible. We don't recommend using React Cache anywhere except very early experiments. Note that React Cache itself isn't strictly tied to React releases, but the current alphas lack basic features as cache invalidation, and you'll run into a wall very soon. We expect to have something usable with this React release.
181181

content/community/articles.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ permalink: community/articles.html
1616
- [The Hands-On Guide to Learning React Hooks](https://www.telerik.com/kendo-react-ui/react-hooks-guide/) - Eric Bishard's step-by-step guide to learning React Hooks.
1717
- [How to Use the React Profiler Component to Measure Render Performance](https://medium.com/@adamhenson/how-to-use-the-react-profiler-component-to-measure-performance-improvements-from-hooks-d43b7092d7a8) - Adam Henson's article exemplifying a use case for `<React.Profiler />`.
1818
- [Thinking in React Hooks](https://wattenberger.com/blog/react-hooks) - Amelia Wattenberger's provides visualizations and highlighting the mindset change needed switching from classes to functional components + hooks.
19+
- [React/Redux Links](https://github.com/markerikson/react-redux-links) - Curated tutorial and resource links by Mark Erikson collected on React, Redux, ES6, and more. Very helpful for all kind of developers because of it's categorised content.

content/community/conferences.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ November 2-4 in Bratislava, Slovakia
8585
### React.js Conf 2016 {#reactjs-conf-2016}
8686
February 22 & 23 in San Francisco, CA
8787

88-
[Website](http://conf.reactjs.com/) - [Schedule](http://conf.reactjs.com/schedule.html) - [Videos](https://www.youtube.com/playlist?list=PLb0IAmt7-GS0M8Q95RIc2lOM6nc77q1IY)
88+
[Website](http://conf2016.reactjs.org/) - [Schedule](http://conf2016.reactjs.org/schedule.html) - [Videos](https://www.youtube.com/playlist?list=PLb0IAmt7-GS0M8Q95RIc2lOM6nc77q1IY)
8989

9090
### React Amsterdam 2016 {#react-amsterdam-2016}
9191
April 16 in Amsterdam, The Netherlands

content/community/meetups.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ Do you have a local React.js meetup? Add it here! (Please keep the list alphabet
102102

103103
## Philippines {#philippines}
104104
* [Manila](https://www.meetup.com/reactjs-developers-manila/)
105+
* [Manila - ReactJS PH](https://www.meetup.com/ReactJS-Philippines/)
105106

106107
## Poland {#poland}
107108
* [Warsaw](https://www.meetup.com/React-js-Warsaw/)

content/docs/hooks-reference.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,50 @@ const value = useContext(MyContext);
195195
>
196196
>`useContext(MyContext)` позволяет только *читать* контекст и подписываться на его изменения. Вам всё ещё нужен `<MyContext.Provider>` выше в дереве, чтобы *предоставить* значение для этого контекста.
197197
198+
**Соеденим все вместе с Context.Provider**
199+
```js{31-36}
200+
const themes = {
201+
light: {
202+
foreground: "#000000",
203+
background: "#eeeeee"
204+
},
205+
dark: {
206+
foreground: "#ffffff",
207+
background: "#222222"
208+
}
209+
};
210+
211+
const ThemeContext = React.createContext(themes.light);
212+
213+
function App() {
214+
return (
215+
<ThemeContext.Provider value={themes.dark}>
216+
<Toolbar />
217+
</ThemeContext.Provider>
218+
);
219+
}
220+
221+
function Toolbar(props) {
222+
return (
223+
<div>
224+
<ThemedButton />
225+
</div>
226+
);
227+
}
228+
229+
function ThemedButton() {
230+
const theme = useContext(ThemeContext);
231+
232+
return (
233+
<button style={{ background: theme.background, color: theme.foreground }}>
234+
Я стилизован темой из контекста!
235+
</button>
236+
);
237+
}
238+
```
239+
Это пример из раздела [Продвинутые темы: Контекст](/docs/context.html), только переписанный с использованием хуков. В этом же разделе можно найти больше информации о том, как и когда использовать объект Context.
240+
241+
198242
## Дополнительные хуки {#additional-hooks}
199243

200244
Следующие хуки являются вариантами базовых из предыдущего раздела или необходимы только для конкретных крайних случаев. Их не требуется основательно изучать заранее.

content/docs/lifting-state-up.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,6 @@ class Calculator extends React.Component {
324324

325325
Если что-то может быть вычислено из пропсов или из состояния, то скорее всего оно не должно находиться в состоянии. Например, вместо сохранения `celsiusValue` и `fahrenheitValue`, мы сохраняем только последнюю введённую температуру (`temperature`) и её шкалу (`scale`). Значение другого поля ввода можно всегда вычислить из них в методе `render()`. Это позволяет очистить или применить округление к значению другого поля, не теряя при этом точности значений, введённых пользователем.
326326

327-
Когда вы видите, что в UI что-то отображается неправильно, то можете воспользоваться расширением [React Developer Tools](https://github.com/facebook/react-devtools). С помощью него можно проверить пропсы и перемещаться по дереву компонентов вверх до тех пор, пока не найдёте тот компонент, который отвечает за обновление состояния. Это позволяет отследить источник багов:
327+
Когда вы видите, что в UI что-то отображается неправильно, то можете воспользоваться расширением [React Developer Tools](https://github.com/facebook/react/tree/master/packages/react-devtools). С помощью него можно проверить пропсы и перемещаться по дереву компонентов вверх до тех пор, пока не найдёте тот компонент, который отвечает за обновление состояния. Это позволяет отследить источник багов:
328328

329329
<img src="../images/docs/react-devtools-state.gif" alt="Мониторинг состояния в React DevTools" max-width="100%" height="100%">

gatsby-config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,5 +162,18 @@ module.exports = {
162162
},
163163
'gatsby-plugin-react-helmet',
164164
'gatsby-plugin-catch-links',
165+
{
166+
resolve: `gatsby-plugin-manifest`,
167+
options: {
168+
name: 'Документация React',
169+
short_name: 'React [RU]',
170+
start_url: '/',
171+
background_color: '#20232a',
172+
theme_color: '#20232a',
173+
display: 'standalone',
174+
icon: 'static/logo-512x512.png',
175+
legacy: true,
176+
},
177+
},
165178
],
166179
};

src/components/LayoutFooter/Footer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ const Footer = ({layoutHasSidebar = false}: {layoutHasSidebar: boolean}) => (
3131
[media.size('sidebarFixed')]: {
3232
paddingTop: 40,
3333
},
34+
'@media print': {
35+
display: 'none',
36+
},
3437
}}>
3538
<Container>
3639
<div

src/components/LayoutHeader/Header.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ const Header = ({location}: {location: Location}) => (
2929
width: '100%',
3030
top: 0,
3131
left: 0,
32+
'@media print': {
33+
display: 'none',
34+
},
3235
}}>
3336
<Container>
3437
<div

src/html.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ export default class HTML extends React.Component {
1919
content="width=device-width, initial-scale=1.0"
2020
/>
2121
<link rel="icon" href="/favicon.ico" />
22+
23+
<meta name="apple-mobile-web-app-capable" content="yes" />
24+
<link rel="apple-touch-icon" href="/logo-180x180.png" />
25+
<meta name="apple-mobile-web-app-title" content="React" />
26+
2227
{this.props.headComponents}
2328
</head>
2429
<body {...this.props.bodyAttributes}>

0 commit comments

Comments
 (0)