Basic Example can't be Reproduced
See original GitHub issueCurrently trying to run the basic example on react-cytoscapejs version 1.0.0 using create-react-app. Here’s what i have done:
npx create-react-app cytoscape-basic-app
cd cytoscape-basic-app
yarn add react-cytoscapejs@1.0.0
At this point, we change the src/App.js
file with the following code modified from the basic example:
import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import CytoscapeComponent from 'react-cytoscapejs';
class App extends Component {
constructor(props){
super(props);
}
render(){
const elements = [
{ data: { id: 'one', label: 'Node 1' }, position: { x: 0, y: 0 } },
{ data: { id: 'two', label: 'Node 2' }, position: { x: 100, y: 0 } },
{ data: { source: 'one', target: 'two', label: 'Edge from Node1 to Node2' } }
];
return <CytoscapeComponent elements={elements} style="width: 600px; height: 600px;" />;
}
}
export default App;
Running yarn start
returns the following error:
./src/App.js
Module not found: Can't resolve 'react-cytoscapejs' in 'C:\Users\xingh\temp\test_cytoscape\cytoscape-app\src'
I solved this by changing the import statement to be:
import CytoscapeComponent from 'react-cytoscapejs/src';
Then the error became:
The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.
in div (created by CytoscapeComponent)
in CytoscapeComponent (at App.js:17)
in App (at src/index.js:7)
which was solved by changing the return statement for the render()
method to:
return <CytoscapeComponent elements={elements} style={{width: "600px", height: "600px"}} />;
Which compiled successfully.
I suggest updating the readme to take those problems into account. Let me know if I should start a PR. Thank you!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
Cannot Reproduce” is misleading; Use “Stopped Investigating ...
The problem with “Cannot Reproduce” is that there is a problem in the software, and the reason for the problem has not been...
Read more >How to Reproduce a Non-Reproducible Defect and Make ...
If the bug is not reproducible, then the testing effort used in finding, analyzing and reporting that particular bug/defect is a total waste....
Read more >Basic research crisis? Many results cannot be replicated
Many scientific studies cannot be replicated and this is symptomatic of a wider crisis in basic research, say scientists.
Read more >How to create a Minimal, Reproducible Example - Help Center
Complete – Provide all parts someone else needs to reproduce your problem in ... Use simple, descriptive names for functions and variables –...
Read more >Fixing Bugs - If You Can't Reproduce a Bug, You Can't Fix It
Fixing a problem usually starts with reproducing it – what Steve McConnell calls “stabilizing the error.” Technically speaking, you can't be ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I published v1.0.1. You should be able to
import CytoscapeComponent from 'react-cytoscapejs'
, and the readme has been updated re. the style attribute in the example.Hi @maxkfranz, still seeing this issue when I try and run the basic example. Implementing above solution fixed it. Could well be user error. Shout out if you want any of my settings.