我正在访问一个reason-react DOM引用,以确定客户端高度。 不幸的是,clientHeight似乎不是ref应用编程接口的一部分。所以这是失败的: ref
-> React.Ref.current
-> Js.Nullable.toOption
-> Belt.Option.map(this => {
React.Ref.clientHeight(this);
}); The value clientHeight can't be found in React.Ref。 有没有办法从引用中提取元件的高度? ref是从div获取的
我一直试图将其应用于每个组件或主index.js组件。然而,到目前为止,这些方法都没有起作用。
import React from 'react';
import { render } from 'react-dom';
import { Router } from 'react-router-dom';
import { Provider } from 'react-redux';
import { store } from './store/index';
import history from './
我玩了几天React,所有的事情看起来都很容易,直到我把这个JS对象重写为一个React组件。
这是带有JS对象的示例。如何将此重写为React组件?
这就是我想要的:
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import ProgressBar from 'progressbar.js';
class Circle extends Component{
componentDidMount() {
this._create
因此,我希望在购物车列表中显示我的购物车项目,因为我已经将cart的初始状态设置为storeProducts,所以在使用map函数时,应该呈现8种产品。我还没有创建我的cartItem.js的ui,但是,我应该有8行文本作为“这是一个购物车项目”从我的cartItem.js。请帮我找出我的密码出了什么问题!非常感谢!
context.js:
class ProductProvider extends React.Component {
state = {
products: storeProducts,
detailProduct: detailProduct,
c