no.input error when using vtk.js in react
See original GitHub issueIm just trying to run the polydatareader example with my data in a react project. I am getting an error on load and on button press stating that there is no input.
here is the code I am using:
import React from 'react';
import vtkActor from 'vtk.js/Sources/Rendering/Core/Actor';
import vtkFullScreenRenderWindow from 'vtk.js/Sources/Rendering/Misc/FullScreenRenderWindow';
import vtkMapper from 'vtk.js/Sources/Rendering/Core/Mapper';
import vtkPolyDataReader from 'vtk.js/Sources/IO/Legacy/PolyDataReader';
export default class VtkGeometryRenderer extends React.Component {
constructor (){
super();
}
shouldComponentUpdate(){
return false;
}
componentDidMount(){
//vtk.js try
const fullScreenRenderer = vtkFullScreenRenderWindow.newInstance();
const renderer = fullScreenRenderer.getRenderer();
const renderWindow = fullScreenRenderer.getRenderWindow();
const resetCamera = renderer.resetCamera;
const render = renderWindow.render;
const reader = vtkPolyDataReader.newInstance();
reader.setUrl(`./Assets/cube_ascii.vtp`).then(() => {
const polydata = reader.getOutputData(0);
const mapper = vtkMapper.newInstance();
const actor = vtkActor.newInstance();
actor.setMapper(mapper);
mapper.setInputData(polydata);
renderer.addActor(actor);
resetCamera();
render();
});
global.reader = reader;
global.fullScreenRenderer = fullScreenRenderer;
}
render() {
return (
<div
ref={(c) => {
this.rootContainer = c;
}}
/>
);
};
and here is the error message and screen im getting on load:

Issue Analytics
- State:
- Created 5 years ago
- Comments:10
Top Results From Across the Web
No input issue and removeActor issue #3 - GitHub
I'm developing a Reactjs front-end using this library. I'm facing some issues and need your help. I got 7 errors (No input!)
Read more >vtk.js No input error - Web - VTK Discourse
I am trying to do volume rendering which works with fullscreenrendering but I want to place it in a div element rather than...
Read more >VTK.js, React, JavaScript: Load VTK files - Stack Overflow
I am using a node server. In addition I have written the code as React code: import React from 'react'; ...
Read more >Starting a vtk.js project from scratch - Kitware, Inc.
This is a quickstart tutorial for using vanilla vtk.js. Initialize your projectLet's start by initializing a new project.
Read more >Sci-Vis on the Web using VTK.js - YouTube
Presented by Bill Sherman. 2018-2019 Scientific Visualization Workshop at Indiana University. Filmed Nov 28, 2018.
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 Free
Top 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

Well the data loads now. I think I can work on making the react component valid on my own. I appreciate all the help, thank you very much.
I’m not saying react is producing that error, I’m just saying that your react component is not valid. But like I said, you are not there yet… The main issue right now is that the data does not load.
But looking closer at your code, the issue is related to your import.
vtk.js/Sources/IO/Legacy/PolyDataReaderis meant for vtk files not vtp. You need to use the XML version which is available here: https://github.com/Kitware/vtk-js/tree/master/Sources/IO/XML/XMLPolyDataReader