React JS

JS – Json.parse silently breaks code

Be aware that JS function JSON.parse silently fails if wrong or any problem in params. It breaks the code which hard to catch bug in. So start from looking into this function while debugging.

0 comments

Saga error – getEventUpdate

uncaught at getEventUpdate at takeLatestHelper at getEventData TypeError: Cannot read property Update saga from 0.14.0 to 0.16.0 fixed it.

0 comments

Solve – cors problem

app.use(function(req, res, next) { res.header(“Access-Control-Allow-Origin”, “*”); res.header(“Access-Control-Allow-Headers”, “Origin, X-Requested-With, Content-Type, Accept”); next(); }); app.get(‘/’, function(req, res, next) { // …. }); app.post(‘/’, function(req, res, next) { // …. });

0 comments

ES6 destructuring hangs

When I changed the following: const orders = this.props.orders; const loadingState = this.props.loadingState; To: const { orders, loadingState } = this.props; The application unexpectedly hanged.

0 comments

sh: 1: cross-env: Permission denied – Fixed

The following fixes it. npm rebuild

0 comments

React createElement – Warning: Unknown prop `childItems` on

The following command creates an element in React. const el = React.createElement( < an html tag or react component >, < attributes or props or {} >, < children elements or text > ) When you pass a non html standard attributes in the second parameter to create html tag like div or p tag […]

0 comments

Ubuntu 17.10 expo and genymotion errors and solutions

Error: Switched to a LAN URL because the tunnel appears to be down. Only devices in the same network can access the app. You can restart the project to try reconnecting. Solution: Due to some bug you must start xde (expo development environment) before genymotion. Also i needed to run xde from root user login. […]

0 comments

The state object

The state object contains the main data object of the application. Anything that changes in the state object will re-render the component. The related method to set a specific key in the state is setState. The set state could be called after componentDidMount is called.   constructor(props) { super(props); this.state = { products: […] }; […]

0 comments