反应中的常量总是具有值“默认值:对象” [英] Const in React always has value "Default : Object"

查看:84
本文介绍了反应中的常量总是具有值“默认值:对象”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SlateJS,并尝试使用以下方式将数据加载到const中: imgData = data.get(file);

I'm using SlateJS and trying to load data into a const using: imgData = data.get("file");

如果我不导入React,这可以正常工作,但是当导入React时,该对象包含下面的值。这个价值是甚么?这是如何发生的?如何避免这种情况?

This works fine if I don't import React, but when React is imported the object contains the value below. What is this value? How does this happen? How do I avoid this?

default: Object
  Children: Object
  Component: ReactComponent(props, context, updater)
  DOM: Object
  PropTypes: Object
  PureComponent: ReactPureComponent(props, context, updater)
  __spread: ()
  cloneElement: (element, props, children)
  createClass: (spec)
  createElement: (type, props, children)
  createFactory: (type)
  createMixin: (mixin)
  isValidElement: (object)
  version: "15.4.1"
  __proto__: Object
  __proto__: Object

非常感谢您提供的任何帮助。

Thanks very much for any help you can provide.

推荐答案

使用它,这将真正帮助您: / p>

use this it would really help you:

imgData = JSON.stringify(data.get("file"));

这篇关于反应中的常量总是具有值“默认值:对象”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆