mirror of
https://github.com/facebook/react.git
synced 2026-02-26 07:25:30 +00:00
Update links to use https:// where it is supported. There's probably a lot more that could be fixed, but these are the core ones I found (especially the download links in order to prevent MITM attacks). Note that there are some fb.me links that will redirect to http:// even while accessed over https://, but this seemed like the best way to fix those for now. NOTE: Only non-third-party files were modified. There are references to http:// URLs in vendored/third-party files, but seems appropriate to fix upstream for those rather than editing the files. Also, copy one image locally to the blog, as it was hotlinking to a site that did not support https://. Last, use youtube-nocookie.com instead of youtube.com for video embeds, as the former doesn't try to set a cookie on load (privacy enhancement).
1.1 KiB
1.1 KiB
id, title, layout, permalink, prev, next
| id | title | layout | permalink | prev | next |
|---|---|---|---|---|---|
| references-to-components | References to Components | tips | references-to-components.html | expose-component-functions.html | children-undefined.html |
If you're using React components in a larger non-React application or transitioning your code to React, you may need to keep references to components. React.render returns a reference to the mounted component:
var myComponent = React.render(<MyComponent />, myContainer);
Keep in mind, however, that the JSX doesn't return a component instance! It's just a ReactElement: a lightweight representation that tells React what the mounted component should look like.
var myComponentElement = <MyComponent />; // This is just a ReactElement.
// Some code here...
var myComponentInstance = React.render(myComponentElement, myContainer);
Note:
This should only ever be used at the top level. Inside components, let your
propsandstatehandle communication with child components, and only reference components via refs.