Question: I'm trying to pass props for width from a parent component to a child JS file, but cannot seem to get the props value in the child JS file. The parent is the following:

```
import React from 'react';
import Child from './Child';
export default class Home extends React.Component {

    state = {
        width: 1000
    }

    render(){

        return(
            <div>
                <Child width={this.width} />
            </div>
        );
    }
}

```

The separate child JS file is the following:

```
import React from 'react';
const svgWidth = 650, // Load prop here
      svgHeight = 340;

```

What I've tried is the following but is not working for me:

```
import React from 'react';
const Child = (props) => {

    console.log({props.width}); // Getting an error that ',' is expected

    return {props.width};
}

```

Can someone please help me with passing the width value from ?

Answer: 
Change to the following, as you should access state through `this.state`, like so:

```
<Child width={this.state.width} />

```
Either use the prop drilling, hence pass the values from parent to child as a prop.
But exact answer to your question will be :
create a blank object in separate js file and export it and then in componentDidMount populate that object with the props which you want to save. Next time when ever you will use that object anywhere in normal js file you will get the props.