8000 More details on using <Plot> with unejected create-react-app · rduque1/react-plotly.js@612e82d · GitHub
[go: up one dir, main page]

Skip to content

Commit 612e82d

Browse files
authored
More details on using <Plot> with unejected create-react-app
1 parent c0ea3ce commit 612e82d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
> A [plotly.js](https://github.com/plotly/plotly.js) React component from [Plotly](https://plot.ly/)
44
5+
👉 [DEMO](http://react-plotly.js-demo.getforge.io/)
6+
👉 [Demo source code](https://github.com/plotly/react-plotly.js-demo-app)
7+
58
***
69

710
## Contents
@@ -105,10 +108,13 @@ render () {
105108
}
106109
```
107110

108-
If you are building with Webpack but do not have access to the Webpack configuration or if you don't want to configure webpack see [build with `create-react-app`(#build-with-create-react-app).
111+
If you are building with Webpack but do not have access to the Webpack configuration or if you don't want to configure webpack see [build with `create-react-app`](#build-with-create-react-app).
109112

110113
#### Build with `create-react-app`
111-
In this case we want to use `react-plotly.js` without building `plotly.js` and use a version of `plotly.js` that is already built. Follow the instructions for [building an external plotly.js](#with-external-plotlyjs).
114+
In this case, we want to use `react-plotly.js` without building `plotly.js` and use a version of `plotly.js` that is already built (see [building an external plotly.js](#with-external-plotlyjs)). This [demo app](http://react-plotly.js-demo.getforge.io/) was built with `create-react-app` and there 3 basic steps:
115+
1. Import plotly.js in a `<script>` tag in [public/index.html](https://github.com/plotly/react-plotly.js-demo-app/blob/master/public/index.html#L25)
116+
2. Declare `Plotly` as a global in [App.js](https://github.com/plotly/react-plotly.js-demo-app/blob/master/src/App.js#L1)
117+
3. Use `createPlotlyComponent()` in [App.js](https://github.com/plotly/react-plotly.js-demo-app/blob/master/src/App.js#L25)
112118

113119
This lets us skip the [specific build configuration](#build-with-webpack) necessary to build `plotly.js` in webpack environments (`create-react-app` uses webpack under the hood).
114120

0 commit comments

Comments
 (0)
0