add Selector functionality
This commit is contained in:
		
							parent
							
								
									7434b1e17e
								
							
						
					
					
						commit
						ccd684fef0
					
				| @ -26,7 +26,8 @@ export const createStore = options => { | |||||||
|     return React.createElement(context.Provider, { value: store }, children) |     return React.createElement(context.Provider, { value: store }, children) | ||||||
|   } |   } | ||||||
|   const useStore = () => useContext(context) |   const useStore = () => useContext(context) | ||||||
|   return { Provider, Consumer: context.Consumer, useStore } |   const useSelector = selector => selector(useContext(context)[0]) | ||||||
|  |   return { Provider, Consumer: context.Consumer, useStore, useSelector } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** Turn a reducer definition object to a function | /** Turn a reducer definition object to a function | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user