React - this.input.value vs handle change

What is better? I have a form with 10 inputs. Should I use this.input.value or handle change and store it in state? handleChange(e) { this.setState({input:}); } ... <input type="text" value={this.state.input} onChange={this....
more »

2017-10-04 21:10 (1) Answers

How to fire onBlur event in React?

I have an input field value that I want to format onBlur, here is what my code looks like: Component: <Input onBlur={this.formatEndpoint} /> Function: formatEndpoint() { let endpoint = this.state.inputEndpoint; endpoint ...
more »

2017-10-04 18:10 (1) Answers

ReactJS - render conditionally whitespace

I'm trying to build a button-component which is able to have icons set before and after the element's children. Therefore, the props are like this: export interface IButtonProps { children?: React.ReactNode; leftIcon?: FontAwesomeIcon; ...
more »

2017-10-04 08:10 (1) Answers

radio buttons in react, ignore null value

so i'm developing a personality quiz app using one of the tutorials i found on the internet //, I have a quizQuestions.js file for api where i fetch the answer and the question from, like so { question: "I am task oriented ...
more »

2017-10-04 05:10 (1) Answers

Input onChange() event is not called

I'm rendering an Input of type='number'. The Input has the value of this.state.value. The Input and all the UI Components are generated via Semantic-UI, but I think that's not of a significant importance info. I also have a custom arrow menu for th...
more »

2017-10-03 22:10 (2) Answers

Injecting Component name into tag in React

This has been asked before, but the solutions don't seem to be working for me... maybe because I am conditionally rendering? The idea is that I have choices for the user to click on, and then the appropriate component is rendered onClick. So I want...
more »

2017-10-03 17:10 (2) Answers

Deleting a record using Mongoose with Redux

I want to delete a record in my mongoDB, when a user presses a button for the given record. For reference: I have all my mongoose and redux code set up, but i get this error: This is my action: //deletes a survey when user clicks button expor...
more »

2017-10-03 13:10 (2) Answers

React-router-dom push

So i'm learning react js thru an ebook and stuck on it, I keep getting error: "Cannot read property 'push' of undefined.." my App.jsx import React from 'react'; import ReactDOM from 'react-dom'; import { HashRouter as Router, Route, Switch, Redir...
more »

2017-10-03 11:10 (1) Answers

Using fineuploader with react-rails

I'm trying to use fineuploader with react and have installed all the relevant dependencies. Following is the code I use:- import React, { Component } from 'react' import FineUploaderTraditional from 'fine-uploader-wrappers' import Gallery f...
more »

2017-10-03 10:10 (2) Answers

Test Mobx inject component

i'm having trouble testing a component with Mobx inject and jest. this is the component: @inject("mainStore") @observer export default class TestContainer extends React.Component { sum(a, b) { return a + b; } render() { r...
more »

2017-10-03 07:10 (1) Answers

React Router Dom one route outside of nest

Hopefully this has a simple answer but I haven't found anyone else asking this: I'm just trying to create a route hierarchy with one route (the signin page in this case) that lives outside of a wrapper, and every other route living inside said wrappe...
more »

2017-10-02 17:10 (1) Answers

React Native - Passing Data Across Screens

I'm having some trouble with a react-native app. I can't figure out how to pass data across screens. I realize that there are other similar questions that are answered on SO, however the solutions did not work for me. I'm using the StackNavigator. ...
more »

2017-10-02 15:10 (3) Answers