Archives : January-2017

I got this error when I run this React code: import React from ‘react’; import ReactDOM from ‘react-dom’; ReactDOM.render( <div id=”root”> <h1>Hello, world!</h1></div>, document.querySelector(‘#root’) ); This is the error: bundle.js:1194 Uncaught Error: _registerComponent(…): Target container is not a DOM element.(…) Source: React Router..

Read more

How can react-router properly handle 404 pages for dynamic content in a Universal app? Let’s say I want to display a user page with a route like ‘/user/:userId’. I would have a config like this: <Route path=”/”> <Route path=”user/:userId” component={UserPage} /> <Route path=”*” component={NotFound} status={404} /> </Route> If I request /user/valid-user-id, I get the user ..

Read more

I’m creating an app with React and React Router, I’m starting with react. I have this parent class: class Home extends React.Component{ checkLogin(){ /*any logic..*/ } /** * La funcion render es obligatoria en cualquier componente React. */ render(){ this.checkLogin(); return( <div> <div className=”body”> <div className=”all-container”> <main className=”container”> <div className=”row”> <div className=”col-md-12 text-center”> <Imagen src=”/images/foodie.png” ..

Read more

I am currently struggling with nesting routes using react router v4. The closest example was the route config in the React-Router v4 Documentation. I want to split my app in 2 different parts. A frontend and an admin area. I was thinking about something like this: <Match pattern=”/” component={Frontpage}> <Match pattern=”/home” component={HomePage} /> <Match pattern=”/about” ..

Read more

Here is the file that’s causing me trouble: var Routers = React.createClass({ getInitialState: function(){ return{ userName: “”, relatives: [] } }, userLoggedIn: function(userName, relatives){ this.setState({ userName: userName, relatives: relatives, }) }, render: function() { return ( <Router history={browserHistory}> <Route path=”/” userLoggedIn={this.userLoggedIn} component={LogIn}/> <Route path=”feed” relatives={this.state.relatives} userName={this.state.userName} component={Feed}/> </Router> ); } }); I am trying to ..

Read more

I am trying to delete row from my list using delete button .I do like this if (state.indexOf(action.payload) > -1) { console.log(‘iff—-‘) state.splice(state.indexOf(action.payload), 1); } console.log(state) return state but it is not deleting the row .here is my code https://plnkr.co/edit/bpSGPLLoDZcofV4DYxPe?p=preview Actually using add button I am generating the list of item and there is delete ..

Read more