1
        <Switch >
        <Route path="/updateSummary" component={UpdateSummary} />
        <Route path="/updateEffort" component={UpdateEffort} />
        </Switch>

I have to send state of parent component as a prop to UpdateSummary. i tried sending like below,

        <Switch >
        <Route path="/updateSummary" component={UpdateSummary 
        {...this.props}} />
        <Route path="/updateEffort" component={UpdateEffort} />
        </Switch>

I am getting error as below

ERROR in ./component/ts/edit.tsx
[tsl] ERROR in D:\DR\component\ts\edit.tsx(99,67)
  TS1005: '}' expected.

ERROR in ./component/ts/edit.tsx
[tsl] ERROR in D:\DR\component\ts\edit.tsx(99,82)
  TS1003: Identifier expected.

Thanks in advance

Basavaraj Hadimani
  • 1,094
  • 12
  • 21

1 Answers1

2

Don't pass the props inside of the component attribute, instead do so like this:

<Switch >
    <Route path="/updateSummary" component={UpdateSummary} {...this.props} />
    <Route path="/updateEffort" component={UpdateEffort} />
</Switch>
sme
  • 4,023
  • 3
  • 28
  • 42