react-dom

React-DOM automatically triggering onClick handler

放肆的年华 提交于 2020-03-25 17:51:07
问题 I have a react-modal which shows some filters. It accepts an isOpen prop which hides or shows the Modal as per the value. The Modal opens successfully when clicked on 'Apply' button, but does not close on clicking 'Cancel'. //Click Handlers in the parent component (filters.js) openAllFilters = () => { this.setState({ showAllFilters: true }); }; closeAllFilters = () => { this.setState({ showAllFilters: false }, () => console.log("state ", this.state.showAllFilters) ); // logs true!); };

ReferenceError: _ref2 is not defined @ react-dom.production.min.js

一笑奈何 提交于 2020-03-02 05:31:26
问题 i am having troubles setting up webpack build configuration. i have two webpack config files, one for development and one for production. everything works fine in dev environment, but when building for production, i get this error: ReferenceError: _ref2 is not defined at e.value (App.js:20) at c (react-dom.production.min.js:147) at beginWork (react-dom.production.min.js:150) at i (react-dom.production.min.js:182) at c (react-dom.production.min.js:183) at l (react-dom.production.min.js:184) at

ReferenceError: _ref2 is not defined @ react-dom.production.min.js

浪尽此生 提交于 2020-03-02 05:29:06
问题 i am having troubles setting up webpack build configuration. i have two webpack config files, one for development and one for production. everything works fine in dev environment, but when building for production, i get this error: ReferenceError: _ref2 is not defined at e.value (App.js:20) at c (react-dom.production.min.js:147) at beginWork (react-dom.production.min.js:150) at i (react-dom.production.min.js:182) at c (react-dom.production.min.js:183) at l (react-dom.production.min.js:184) at

Since updating react-dom and react-router-dom packages: behaviors executing additional times

浪子不回头ぞ 提交于 2020-01-06 04:46:06
问题 I've inherited a react/node/prismic application where we need to update the prismic-reactjs package, which resulted in needing to update a few others- in total, we changed: prismic-reactjs: 0.2.0 → 1.1.0 react: 15.6.1 → 16.0.0 webpack: 3.12.0 → 4.39.2 react-dom: 15.6.1 → 16.0.0 react-router-dom: 4.1.2 → 5.0.1 extract-text-webpack-plugin (deprecated) → mini-css-extract-plugin Then removed one use of "withRouter()" because of new error when starting up the local server (but I confirmed in

Resetting Values in ReactDOM Ref children (Best Practices?)

大城市里の小女人 提交于 2020-01-05 05:49:07
问题 I've got a stateless component, called FlexibleInput. import React, { PropTypes } from 'react' export default function FlexibleInput({ id, label, defaultValue, type, onChange, }){ let fieldClass = `${id}-field` return ( <fieldset className={fieldClass}> <label htmlFor={id}>{label}</label> <input key={id} id={id} type={type} defaultValue={defaultValue} onChange={onChange} /> </fieldset> ) } FlexibleInput.propTypes = { id: PropTypes.string.isRequired, label: PropTypes.string.isRequired,

Webpack2, how to exclude react and react dom from build

对着背影说爱祢 提交于 2020-01-04 23:43:09
问题 My goal is to create a module for a react components library made in ES6 using webpack. I am using: webpack: "2.1.0-beta.25" react: "15.4.1" I need to assign react and react-dom as peerDependencies so it doesn't get downloaded by the developer. This is the relevant part of my package.json : "peerDependencies": { "react": "15.4.1" }, "dependencies": { "chalk": "1.1.3", "compression": "1.6.2", "cross-env": "3.1.3", "immutable": "3.8.1", "invariant": "2.2.1", "lodash": "4.16.4", "minimist": "1.2

How to configure nextjs 9 and ant design less compatibility?

时光总嘲笑我的痴心妄想 提交于 2020-01-04 06:38:28
问题 After upgrading react , react-dom and nextjs this error happens : Build error occurred /home/lenovo/.../node_modules/antd/lib/style/index.css:7 body { ^ SyntaxError: Unexpected token { at Module._compile (internal/modules/cjs/loader.js:720:22) at Object.Module._extensions..js (internal/modules/cjs/loader.js:788:10) at Module.load (internal/modules/cjs/loader.js:643:32) { type: 'SyntaxError', '$error': '$error' } events.js:180 throw er; // Unhandled 'error' event ^ Error: write EPIPE ... at

How to configure nextjs 9 and ant design less compatibility?

混江龙づ霸主 提交于 2020-01-04 06:36:02
问题 After upgrading react , react-dom and nextjs this error happens : Build error occurred /home/lenovo/.../node_modules/antd/lib/style/index.css:7 body { ^ SyntaxError: Unexpected token { at Module._compile (internal/modules/cjs/loader.js:720:22) at Object.Module._extensions..js (internal/modules/cjs/loader.js:788:10) at Module.load (internal/modules/cjs/loader.js:643:32) { type: 'SyntaxError', '$error': '$error' } events.js:180 throw er; // Unhandled 'error' event ^ Error: write EPIPE ... at

reactjs - expose react component methods outside react tree

天大地大妈咪最大 提交于 2020-01-03 17:32:54
问题 Question: How can I expose a react component's methods to other places? For example, I want to call React-Router's this.context.router.push(location) from an element outside of React. Perhaps I could add a React component's method to the window object so it can be called from any generic DOM event listener or even the console? Background/Use Case: I want to use jQuery DataTables in my React app because it provides many plugins and config which are still unavailable in the React ecosystem. I

React changing input type via event

落花浮王杯 提交于 2020-01-03 03:10:06
问题 I'm trying to extend a React input component, which needs to be type password and after certain event on the element or element next to it - it needs to toggle the type of the input (type="text/password"). How this can be handled by React? I have this as class for my component: import { React, Component } from 'lib' export class PasswordInput extends Component { constructor(props, context){ super(props, context) const { type, validate, password } = this.props if(context.onValidate && password