I have this code right here, that works in this online text editor: https://codesandbox.io/s/o4n0v203vy
In the npm console , everything is okay:
But in the browser , this happens:
What logs in the console, when i do export var renderTree = (node, setActiveNode, activeNode) => { console.log(node && node.type, 'look here');
I can't figure out why is this happening. Any help is appreciated! Thanks!
The variable node
is undefined
so doesn't have a property called type
.
Change your check to
if(node && node.type === 'file'){
...
}
您可能正在浏览器中运行源文件,而不是已构建的文件。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.