I am working with react native and I want to pass function and some data from **Component** class to another **Stateless** class, but I could not make to passing function and data part.

**Here you can see my Component class:**

```
class Classroom extends Component {

    constructor(props, context) {
        super(props, context);

    };

    state = {
        isLightOn: false,
        title : "Turn light on "
    }

   onPress() {
       this.setState({isLightOn: !this.state.isLightOn})
       console.log(this.state.isLightOn)
       this.setState({title:this.state.isLightOn===false ?"Turn light off":"Turn light on"})

   }

    render() {
        return (
            <View style={styles.blue}>

                <LightBulb  isLightOn={this.state.isLightOn}> </LightBulb>
                <LightButton onPress={this.onPress} isLightOn={this.state.isLightOn} title={this.state.title} > </LightButton>

            </View>
        );
    }

}

```

Firstly, I want to pass **isLightOn** and **title** datas to my **LightButton** class (which mean to my stateless class). After that, I want to use onPress function inside of my Stateless class, but I cannot use. I am taking that error:

Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.

I also LightButton onPress={this.onPress} remove parenthesis, but still taking error.

**Here is my my Stateless class**

```
const LightButton = ({onPress,isLightOn,title}) => (

        <View style={styles.red}>

            <Button
                title= {title}
                onPress={() => {}

                }
            />
        </View>
)

```

I want to use onPress function and datas inside of the this class.
As a result, How can I pass function and data to that class?