Archives : October-2017

I have this code: … import { match, RouteComponentProps } from “react-router”; import * as H from ‘history’; interface oneRoute { path: string; exact?: boolean; main: any; } interface ITestProps { id: string; } class Test extends React.Component<RouteComponentProps<ITestProps>, {}> { public render() { return <div>Hallow id:{this.props.match.params.id} — {JSON.stringify(this.props.match)}</div> } } export const routesData: oneRoute[] = ..

Read more

I use standart VisualStudio 2017 ASP.NET Core 2.0 React Template. I have class Home from template: import { RouteComponentProps } from ‘react-router’; export class Home extends React.Component<RouteComponentProps<{}>, {}> { public render() { return <div> <h1>Hello, world!</h1> </div>; } } I need to make routesData array and to bind components like Home to ‘Layout’ Routes. Here ..

Read more

I’m using react-router and I want to render a menu component when the user is not in the root and not in the /login path. This is what I have so far <Route path=”/:subpath” component={TopMenuComponent} /> <div> <Route exact path=”/” render={props => ( <LoginContainer {…props} setTitle={this.setTitle} /> )} /> <Route path=’/landing’ component={LandingComponent} /> </div> takes ..

Read more

I’ve seen similar posts but couldn’t find an answer and in my case, I’m trying to pass an action from <App />: addExpense = (expense) => { console.log(‘Hello From AddExpenseForm’); } to /create route where I’m rendering <AddExpenseForm /> component <Link to={{ pathname: ‘/create’, state: { addExpense: this.addExpense } }}> Create Expense</Link> The link is ..

Read more