Using react-router with Express server

I have a React app that is being served by a simple Express server. The React app is being webpack'd into a directory called dist in my root directory (where the server.js file is located as well). The dist folder includes the index.html entry point,...
more »

2017-01-11 21:01 (1) Answers

Ignore and skip requirejs dependency

In my webapplication I have ReactJS bundled together with the my code and included as into html page. We also have set of modules that we load using requireJs. And one of those modules is built using WebPack as umd target. Whenever the client tries...
more »

2017-01-11 18:01 (1) Answers

React dynamically set custom tags

Rather than having to create a component per custom header type, I would like to do so dynamically. const HEADERS = { 'header-one': 'h1', 'header-two': 'h2', 'header-three': 'h3', 'header-four': 'h4', 'header-five': 'h5', }; _ let ...
more »

2017-01-11 18:01 (1) Answers

Set Prop Key Dynamically JSX

I'm wondering if it's possible to do the following in JSX (this code does not work, just an example of what I'm trying to do): const propKey = 'someProp'; const jsx = <MyComponent [propKey]="some value" />; // evaluates to <MyComponent some...
more »

2017-01-11 16:01 (2) Answers

Proxify websocket requests in Sails.js

We use React for the UI of our app and Sails.js back-end for managing users authentication and authorization. Also thanks to Sails we hide all API requests (those are made from React) to our external servers and we make sure that the requests are mad...
more »

2017-01-11 16:01 (0) Answers

React server side rendering - support for hashbang

I'm porting my website from an Angular client side site to React with server side rendering. I'm using the React starter kit with the universal-router. My customers have old links that use the hashbang form. How can I support these old links in my n...
more »

2017-01-11 15:01 (1) Answers

Save data async

I want to store the values from 2 text inputs in my phone and use the data after. I'm trying to save the data but there is only one character stored... can someone explain to me why please? import React, { Component } from 'react'; import { Touc...
more »

2017-01-11 14:01 (2) Answers

Comparing 2 different set of data array

I have an app that are retrieving 2 sets of data. Now I want to do is get the brand of data1 and and the brand of data2 which depends on the date, if true it will render the amount of data2. so far this is my code -my data const data1 = [ { ...
more »

2017-01-11 10:01 (4) Answers

Local copy of React prop is read-only

Let's say I have two Components. The parent is passed an Object as a property, which it then copies into local data store. It has a function to update this local store, which gets passed down to a child. Here is my parent Component: const Parent = (...
more »

2017-01-11 04:01 (2) Answers

CSS changes on new line in react component

I have a react component that contains inline-block div items each with a border right to provide a 'divider' visual. However, if it reaches the max width of the parent component, whether through initial loading or further resizing of the window, the...
more »

2017-01-11 03:01 (2) Answers

What's wrong with using object as a PropType?

I see that Airbnb's style guide includes forbid-prop-types for type object. (as can be seen here) Can someone explain why I would want to forbid the use of PropType.object? Is it just that it's too vague? And if so, how can I be more specific? ...
more »

2017-01-10 01:01 (1) Answers

React Native rendering same route

I want to change routes on button press in React Native. In my SplashContainer component this is the method I'm running: handleToSignUp = () => { console.log("Running handleToSignUp") this.props.navigator.push({ signUpForm: true ...
more »

2017-01-09 22:01 (1) Answers

Passing props through too many levels

Consider this Parent component (prop: textColor) intermediate component 1 intermediate component 2 intermediate component N Component with text (needs textColor) How do I go about avoiding passing textColor through intermediate components explicit...
more »

2017-01-09 17:01 (2) Answers

inline editing todo list can't change input value

I think I missed something but don't know what is it, I know value={this.text} will bind the state's value, but since this is inline editing, I want to fill the input field with its existing value instead of blank. http://jsbin.com/fugowebovi/1/edit...
more »

2017-01-09 14:01 (2) Answers

React ES6 onSubmit() does not work

I'm currently working on a project using webpack and babel to build a project. I tried so many things as I can think of, but somehow onSubmit or onClick function do not work no matter how I bind those functions. Here is the code snippet of the code. ...
more »

2017-01-09 12:01 (2) Answers

ReactJS navigation menu

I am new to react JS. Below is the code for our MainMenu navigation. I would like to display the "Logout" only if the user is already signed in (We use Google Signin API in another JS file). How do I achieve this? import React from 'react'; import ...
more »

2017-01-09 11:01 (1) Answers