Syntax of arrow functions

const fetch = url => dispatch => { // ... } export const fetchQuestions = tag => (dispatch) => { return dispatch(fetch(tag)); }; What is dispatch in the fetch function ? url is a first and single parameter fetch function. But what ...
more »

2017-07-17 16:07 (4) Answers

Async request in Redux

Here is my store: import {createStore, applyMiddleware} from 'redux'; import reducerFoo from './reducers/reducer'; import thunkMiddleware from 'redux-thunk'; export default function configureStore() { return createStore( reducerFoo, apply...
more »

2017-07-16 21:07 (1) Answers

ReactJS and nested routes with react-router v4

I am making a website with ReactJS and I am using react-router v4 to navigate through website pages. I am trying to use nested routes to achieve the same result as shown in the diagram I uploaded. To be more clear, I want to have some kind of layout...
more »

2017-07-16 20:07 (2) Answers

setState not a function after binding this

I have a simple form allowing users to create a plain text post. The code below generates a successful server side response following the createPostRequest call. However, following a successful post, I would like to update the state to empty out the ...
more »

2017-07-16 17:07 (1) Answers

How does React make props read only?

I'm wondering what mechanism they actually use to throw an error when trying to set this.props.a = 1 or something similar. I ask because when logging props I don't see anything like [Getter/Setter] which I assumed is what they were doing. Thanks! ...
more »

2017-07-16 15:07 (0) Answers

ReactJs Using refs for focusing an input

I'm trying to use refs is ReactJs, to focus the textbox from a button click. But I get the following error message:- bundle.js:114 Uncaught TypeError: Cannot read property 'focus' of undefined Source Code class FocusText extends Component{ ...
more »

2017-07-16 12:07 (3) Answers

react export Unexpected token

So I have these file and folder. App.js modules/ user/ index.js list.js In list.js I have export default (props) => (...) In index.js I have export UserList from './list'; And in App.js I have import { UserList } from './modules/use...
more »

2017-07-16 12:07 (1) Answers

How to clear uncontrolled field in react

I used to use ref for forms but now I always state for forms, I'm facing an issue where I have to clear a field after user submitted something. handleSumbit = (e) => { e.preventDefault() const todoText = this.state.todoText ...
more »

2017-07-16 08:07 (2) Answers

ReactJS redux subscribe statements

Is store.subscribe( () => {} ) the only way to watch for changes in the Redux stores? I fetch my users asynchronously and by the time the app is loaded the Users store is most likely empty so I have to do something like this: store.subscribe( () =...
more »

2017-07-15 18:07 (1) Answers

React-Google-Maps: Marker resizes after zooming

I am using "react-google-maps" https://github.com/tomchentw/react-google-maps in my React project. To illustrate my problem please find below two pictures. The first one shows how the map looks right after loading, the second one shows how it looks ...
more »

2017-07-15 16:07 (0) Answers

Partial Password Masking on Input Field

So I need to mask a SSN# input field, lets say the ssn is 123-45-6789, I need to display ***-**-6789 (real time as they enter each digit) but I still need to retain the original value to submit. I got to the point where I can do that if the user st...
more »

2017-07-15 02:07 (2) Answers

Semantic UI React - Center form in segment?

I am trying to center a form group within a segment in semantic-ui-react. By setting the container textAlign to center, I am able to get all elements centered except the Form.Group and the Form.Input's it contains. Example: https://jsfiddle.net/m...
more »

2017-07-14 23:07 (1) Answers

How to save a rendered component to memory?

I'm developing a React Native application (although I think my issue applies to React in general) made of multiple screens. So I've created a simple component to switch the screens: import React, { Component } from 'react'; import { connect } from ...
more »

2017-07-14 23:07 (3) Answers

react vr border not working

I want to put a border around my text. <View style={{ borderRadius: 1, borderWidth: 1, borderColor:'#FF0000',}}> <Text style={{ fontSize: 0.8, fontWeight: '400', layoutOrigin: [0....
more »

2017-07-14 19:07 (1) Answers

renderRow index from each row in react native

I am trying to get the current index of renderRow but I dont seem to get it. I have also tried to add i in as a variable inside renderRow. I am making highscore and it would be super convenient if I could just get the number from renderRow itself. If...
more »

2017-07-14 19:07 (1) Answers

ReactJS unrecognised token import

I am currently trying to learn to use ReactJS but I am have hit an issue and I can't seem to find the right thing to fix it. I've installed npm and run npm --install react and npm --install react-dom in the root of my project. The project is HTML/J...
more »

2017-07-14 18:07 (1) Answers

Calling a function in React

I'm a beginner in React, and I'm little confused about calling a function in React. I saw the following ways and i don't when to use and which one. handleAddTodo ={this.handleAddTodo} handleAddTodo ={this.handleAddTodo()} handleAddTodo ={handleAdd...
more »

2017-07-14 11:07 (6) Answers

Performance improvement to React Text Clamp?

I'm trying to make a reusable React text-clamp component. The user passes in the number of lines to render and the text they want to display, and the component renders their text, cutting it off at the specified number of lines and inserting an ellip...
more »

2017-07-14 00:07 (1) Answers

How to run eslint in create react app

Help to run eslint in create react app. I created react app with tutorial Then I installed babel-eslint standard snazzy and then I added to script in package.json next line "lint": "standart --verbose | snazzy" and now I tried to run eslin...
more »

2017-07-13 21:07 (1) Answers