You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					24 lines
				
				535 B
			
		
		
			
		
	
	
					24 lines
				
				535 B
			| 
								 
											3 years ago
										 
									 | 
							
								import * as React from 'react';
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export default function createReactContext<T>(
							 | 
						||
| 
								 | 
							
								  defaultValue: T,
							 | 
						||
| 
								 | 
							
								  calculateChangedBits?: (prev: T, next: T) => number
							 | 
						||
| 
								 | 
							
								): Context<T>;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								type RenderFn<T> = (value: T) => React.ReactNode;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export type Context<T> = {
							 | 
						||
| 
								 | 
							
								  Provider: React.ComponentClass<ProviderProps<T>>;
							 | 
						||
| 
								 | 
							
								  Consumer: React.ComponentClass<ConsumerProps<T>>;
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export type ProviderProps<T> = {
							 | 
						||
| 
								 | 
							
								  value: T;
							 | 
						||
| 
								 | 
							
								  children: React.ReactNode;
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export type ConsumerProps<T> = {
							 | 
						||
| 
								 | 
							
								  children: RenderFn<T> | [RenderFn<T>];
							 | 
						||
| 
								 | 
							
								  observedBits?: number;
							 | 
						||
| 
								 | 
							
								};
							 |