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 { generate, parse, t, traverse } = require('./babel'); | |
| const source = ` | |
| const babel = "cool"; | |
| function test(babel) { | |
| return babel; | |
| } | |
| `; | |
| // var babel = "cool"; |
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
| import React from 'react'; | |
| const useActions = (actions, initialState) => { | |
| const [state, setState] = React.useState(initialState); | |
| const functions = Object.entries(actions).reduce( | |
| (accumulator, [name, action]) => ({ | |
| ...accumulator, | |
| [name]: () => setState(action) | |
| }), | |
| {} |