PTC

import React, { Component } from 'react' import { AppRegistry, StyleSheet, Text, View, TouchableOpacity } from 'react-native' class Child extends Component{ state = { val:10 } render(){ this.childFun = function(num){ this.setState({val:this.state.val+num}) } let {val} = this.state return( {val} ) } }

class App extends Component {

render() { this.parentFun = ()=>{ this.refs.mark.childFun(10) } return ( BUTTON ) } }

const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, welcome: { fontSize: 20, textAlign: 'center', margin: 10, }, })

AppRegistry.registerComponent('App', () => App)

JSRUN前端笔记, 是针对前端工程师开放的一个笔记分享平台,是前端工程师记录重点、分享经验的一个笔记本。JSRUN前端采用的 MarkDown 语法 (极客专用语法), 这里只属于前端工程师。