microsoftgraph / msgraph-sample-reactspa

This sample demonstrates how to use the Microsoft Graph JavaScript SDK to access data in Office 365 from React browser apps.
MIT License
125 stars 105 forks source link

https://docs.microsoft.com/en-us/graph/tutorials/react?tutorial-step=3 is not building #59

Closed jrutanen closed 3 years ago

jrutanen commented 3 years ago

Where did you get the code?

Describe the bug

There is a mistake in the tutorial page for the AuthProvider.tsx render function.

render() {
  return <WrappedComponent
    error = { this.state.error }
    isAuthenticated = { this.state.isAuthenticated }
    user = { this.state.user }
    login = { () => this.login() }
    logout = { () => this.logout() }
    getAccessToken = { (scopes: string[]) => this.getAccessToken(scopes)}
    setError = { (message: string, debug: string) => this.setErrorMessage(message, debug)}
    {...this.props} {...this.state} />;

-> {...this.state} is causing build error, this code is already fixed in the github, but should be updated in the tutorial

To Reproduce

Steps to reproduce the behavior:

Copy the code from the tutorial until step 3 and try to run it. You'll get error message F:/code/webDev/ReactMsGraph/LearningMsGraph/graph-tutorial/src/AuthProvider.tsx TypeScript error in F:/code/webDev/ReactMsGraph/LearningMsGraph/graph-tutorial/src/AuthProvider.tsx(58,21): 'error' is specified more than once, so this usage will be overwritten. TS2783

56 |             render() {
57 |                 return <WrappedComponent

58 | error = { this.state.error } | ^ 59 | isAuthenticated = { this.state.isAuthenticated } 60 | user = { this.state.user } 61 | login = { () => this.login() }

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

I expected that the tutorial code would build without errors.

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop

Dependency versions

Additional context

Add any other context about the problem here.

jasonjoh commented 3 years ago

Thanks @jrutanen! Pushing a fix for this today.