@@ -9,29 +9,29 @@ export default function createStore(defaultStore = {}, defaultCallbacks = {}) {
99 let allCallbacks = defaultCallbacks ;
1010
1111 /**
12- * Provider of the store
12+ * Store of the store
1313 *
1414 * @example
1515 *
1616 * // Default usage
17- * const { Provider } = createStore({ count: 0 })
17+ * const { Store } = createStore({ count: 0 })
1818 * // ...
19- * <Provider >{children}</Provider >
19+ * <Store >{children}</Store >
2020 *
21- * // Creating the default store in the Provider
22- * const { Provider } = createStore()
21+ * // Creating the default store in the Store
22+ * const { Store } = createStore()
2323 * // ...
24- * <Provider store={{ count: 0 }}>{children}</Provider >
24+ * <Store store={{ count: 0 }}>{children}</Store >
2525 *
2626 * // Defining callbacks
27- * const { Provider } = createStore({ count: 0 })
27+ * const { Store } = createStore({ count: 0 })
2828 * // ...
29- * <Provider callbacks={{ count: (v) => console.log(v) }}>
29+ * <Store callbacks={{ count: (v) => console.log(v) }}>
3030 * {children}
31- * </Provider >
31+ * </Store >
3232 * @return {React.ReactNode } children
3333 */
34- function Provider ( { store = { } , callbacks = { } , children} ) {
34+ function Store ( { store = { } , callbacks = { } , children} ) {
3535 const initialized = useRef ( ) ;
3636
3737 if ( ! initialized . current ) {
@@ -68,7 +68,7 @@ export default function createStore(defaultStore = {}, defaultCallbacks = {}) {
6868 discard : new Set ( [ 'prototype' , 'isReactComponent' ] ) ,
6969 get ( _ , path ) {
7070 if ( ! this . discard . has ( path ) ) this . path . push ( path ) ;
71- return new Proxy ( ( ) => { } , validator ) ;
71+ return new Proxy ( ( ) => { } , validator ) ;
7272 } ,
7373 apply ( t , _ , args ) {
7474 const path = this . path . slice ( ) ;
@@ -102,7 +102,7 @@ export default function createStore(defaultStore = {}, defaultCallbacks = {}) {
102102 return [ value , update , resetField ( prop ) ] ;
103103 } ,
104104 } ;
105- const useStore = new Proxy ( ( ) => { } , validator ) ;
105+ const useStore = new Proxy ( ( ) => { } , validator ) ;
106106
107107 /**
108108 * Hook to register a listener to force a render when the
@@ -194,12 +194,12 @@ export default function createStore(defaultStore = {}, defaultCallbacks = {}) {
194194 }
195195
196196 /**
197- * createStore function returns the Provider component with the
197+ * createStore function returns the Store component with the
198198 * useStore hook.
199199 *
200- * @returns {object } { Provider , useStore }
200+ * @returns {object } { Store , useStore }
201201 */
202- return { Provider , useStore} ;
202+ return { Store , useStore} ;
203203}
204204
205205// ##########################################################
0 commit comments