我在react.js项目中工作,使用material-ui和sass.I。我需要创建像ChatBit组件这样的组件,然后我编写了它作为它发布。 customComponent.js文件。 // @flow
import * as React from 'react';
import { useState } from 'react';
import { Avatar} from "@material-ui/core";
import useStyle from './styles';
我正在尝试使用rollup发布一个库,以构建一个包供其他项目重用。
但我在构建的bundle中遇到了导入映射问题,因为我在源代码中使用了路径别名。
对于示例
import theme from '@src/styles/modules/theme.module.scss'
import PdfIcon from '@src/assets/icons/pdf.svg'
我的汇总配置
import resolve from "rollup-plugin-node-resolve"
import babel from "rollup-plugi
在简单的旧语义-UI没有反应,我已经能够把一个表单在一个模式中,没有任何问题。
使用语义-UI+ React版本,我能够在模型中显示表单,但它不像我所期望的那样工作。
例如,在模态显示之后,也会显示模态内的表单。如果我开始输入输入字段,就会显示这个错误:
Error: Invariant Violation: findComponentRoot(..., .1.1.1.0.4.0.0.1): Unable to find element. This probably means the DOM was unexpectedly mutated (e.g., by the browser), u
我创建了一个app form office ui fabric components。Fabric组件"Persona“已呈现。但是我不能渲染列表组件。我附上了下面的代码。
import * as React from 'react';
import {
FocusZone,
FocusZoneDirection
} from 'office-ui-fabric-react/lib/FocusZone';
import { List } from 'office-ui-fabric-react/lib/List';
imp
当向我已经存在的应用程序添加实质性UI时,我遇到了一个问题。基本上发生的事情是,当我在我的模型中添加重要的UI组件时,模态的输入动画不会触发。将材料UI降到1.0.0或删除所有MUI组件解决了这个问题。此外,使用任何其他UI库都不会导致此问题。
import React, { useState, useEffect } from "react";
import styled from "styled-components";
import Test from "./Test";
const Overlay = styled.div`
po
每次在React.js中执行渲染时,UI都会滚动到页面顶部。
JSFiddle:
有什么好的或被动的方法来阻止这种情况吗?
例如,如果用户向下滚动页面,然后按下导致呈现的按钮,则UI将停留在与以前相同的滚动位置。
// Forces a render which scrolls to top of page
this.setState({data: data});
更新:为什么某些渲染的UI会滚动到顶部,而其他渲染则不会?