This file contains 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
// Original code | |
const score = 7; | |
const someVar = | |
score < 10 ? 'some long string' : | |
score < 20 ? 'this is looking promising' : | |
score < 30 ? 'passing' : | |
score < 40 ? 'proficient' : | |
'expert'; | |
// What Prettier does |
This file contains 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 stateMap = {}; | |
function render(state) { | |
for (const component of state.components) component.forceUpdate(); | |
} | |
export default function useTopState(name, initialValue) { | |
let state = stateMap[name]; | |
if (!state) { |
OlderNewer