mirror of
https://github.com/maputnik/editor.git
synced 2026-08-26 15:07:41 +00:00
Tidy of components
- Moved all components into a single directory like nextjs - Made component names consistent with each other - Made component names consistent with their export class names - Added storybook for a few components with the aim to extend this further.
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import React, {useState} from 'react';
|
||||
import {action} from '@storybook/addon-actions';
|
||||
|
||||
export function useActionState (name, initialVal) {
|
||||
const [val, fn] = useState(initialVal);
|
||||
const actionFn = action(name);
|
||||
function retFn(val) {
|
||||
actionFn(val);
|
||||
return fn(val);
|
||||
}
|
||||
return [val, retFn];
|
||||
}
|
||||
Reference in New Issue
Block a user