diff --git a/common_usage_case/react.js b/common_usage_case/react.js new file mode 100644 index 0000000..bd705e2 --- /dev/null +++ b/common_usage_case/react.js @@ -0,0 +1,36 @@ +function getArticleTem() { + //简单传递 + const clickHandler = () => { + console.log('') + } + //事件参数e,e可以被console接收 + const clickHandler = (e) => { + console.log('',e) + } + return( +
+ + { + articleType === 1 ? Loading... : + articleType === 2 ? Error occurred : + articleType === 3 ? Operation successful : + Unknown status + } +
+ ) + + //形参传递实参 : 利用箭头函数的形式引用 + const clickHandler = (name) => { + console.log('',name) + } + return() + + + //同时传递事件对象和自定义参数 + const clickHandler = (name , e) => { + console.log('',name , e) + } + return() + + } + \ No newline at end of file