This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "type": "div", | |
| "style": { | |
| "height": 300, | |
| "fontSize": 14, | |
| "fontWeight": "bold", | |
| "textAlign": "center" | |
| }, | |
| "children": [ | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function resolveStyles(component) { | |
| // Restrict it from displaying in a smaller size | |
| if (component.style.height < 300) { | |
| component.style['height'] = 300 | |
| } | |
| if (component.type === 'button') { | |
| // Give all button components a dashed teal border | |
| component.style['border'] = '1px dashed teal' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function start(component) { | |
| // Restrict it from displaying in a smaller size | |
| if (component.style.height < 300) { | |
| component.style['height'] = 300 | |
| } | |
| if (component.type === 'button') { | |
| // Give all button components a dashed teal border | |
| component.style['border'] = '1px dashed teal' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "type": "div", | |
| "style": { | |
| "height": 300, | |
| "fontSize": 14, | |
| "fontWeight": "bold", | |
| "textAlign": "center" | |
| }, | |
| "children": [ | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "type": "div", | |
| "style": { | |
| "height": 300, | |
| "fontSize": 14, | |
| "fontWeight": "bold", | |
| "textAlign": "center" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function start(component) { | |
| // Restrict it from displaying in a smaller size | |
| if (component.style.height < 300) { | |
| component.style['height'] = 300 | |
| } | |
| if (component.type === 'button') { | |
| // Give all button components a dashed teal border | |
| component.style['border'] = '1px dashed teal' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const component = { | |
| type: 'label', | |
| style: { | |
| height: 250, | |
| fontSize: 14, | |
| fontWeight: 'bold', | |
| textAlign: 'center', | |
| }, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getDate(callback) { | |
| return callback(new Date()) | |
| } | |
| function start(callback) { | |
| return getDate(callback) | |
| } | |
| start(function (date) { | |
| console.log(`Todays date: ${date}`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function onChange(e, { ref }) { | |
| console.log(`current state value: ${value}`) | |
| console.log(`incoming value: ${e.target.value}`) | |
| setValue(e.target.value) | |
| console.log(`current state value now: ${value}`) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function App() { | |
| const [value, setValue] = React.useState('') | |
| function onChange(e, { ref }) { | |
| console.log(`current state value: ${value}`) | |
| console.log(`incoming value: ${e.target.value}`) | |
| setValue(e.target.value) | |
| console.log(`current state value now: ${value}`) | |
| } | |