Archives : July-2017

could you please tell me how to implement tabs in react with using any library ? I follow this link and tried to make tabs https://toddmotto.com/creating-a-tabs-component-with-react/ but not succeeded. Here is my code: https://codesandbox.io/s/D9Q6qWPEn import React, {Component} from ‘react’; class Tabs extends Component { constructor() { super(); this.state= { selected:0 } } _renderContent() { return ..

Read more

I want to be able to create a link to the same route I’m on, except for changes to some parameters. In my website, I decided to have a URL structured like this: /list/:page(d+)?/:filter?. Now, in my component I have access to match (using withRouter HOC). In my situation it contains { isExact: true params: ..

Read more

I’m trying to use React’s context feature to maintain information about the user throughout the application (e.g. the user ID, which will be used in API calls by various pages). I’m aware that this is an undocumented and not recommended over Redux, but my application is pretty simple (so I don’t want or need the ..

Read more

I have problem passing id to my page with product, I tried everything and search answer but it still doesn’t work. Here is my index.js: import React from "react"; import {render} from "react-dom"; import {Router, Route, IndexRoute, hashHistory} from "react-router"; import {Menu} from ‘./components/Menu’; import {MainPage} from ‘./components/MainPage’; import {DetailsProduct} from ‘./components/DetailsProduct’; class App extends ..

Read more

(react-router-dom version: 4.1.1) I have working routes set up, but I’m a bit confused about why the <Switch> was necessary: index.js import React from ‘react’; import { HashRouter, Route, Switch } from ‘react-router-dom’; import App from ‘./components/App.jsx’; import FridgePage from ‘./components/FridgePage.jsx’; ReactDOM.render( <HashRouter> <Switch> <Route exact path=”/” component={App} /> <Route path=”/fridge” component={FridgePage} /> </Switch> </HashRouter>, ..

Read more