1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import React, { Component } from 'react'; export const Buttons = ({ go, caution, stop, lightStatus }) => { return( <div style={{textAlign: 'center'}}> <button onClick={go} disabled={lightStatus == 'GO' || lightStatus == 'CAUTION'} style={{cursor: 'pointer'}}> Go </button> <button onClick={caution} disabled={lightStatus == 'CAUTION' || lightStatus == 'STOP'} style={{cursor: 'pointer'}}> Caution </button> <button onClick={stop} disabled={lightStatus == 'STOP' || lightStatus == 'GO'} style={{cursor: 'pointer'}}> Stop </button> </div> ) } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import React from 'react'; import ReactDOM from 'react-dom'; import Redux, { createStore } from 'redux'; import { Provider } from 'react-redux'; import { reducer } from './reducer'; import { App } from './app'; ReactDOM.render( <Provider store={createStore(reducer)}> <App /> </Provider>, document.getElementById('root') ) |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |