react-wizard-primitive
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -1,2 +0,2 @@ | ||
import React, { useState, useContext } from 'react'; | ||
import React, { useState, useContext, useRef } from 'react'; | ||
@@ -60,3 +60,9 @@ const WizardContext = React.createContext(null); | ||
} | ||
return props.children(wizardContext.getStep()); | ||
const contextRef = useRef(null); | ||
const stepRef = useRef(null); | ||
if (contextRef.current !== wizardContext) { | ||
contextRef.current = wizardContext; | ||
stepRef.current = wizardContext.getStep(); | ||
} | ||
return props.children(stepRef.current); | ||
}; | ||
@@ -63,0 +69,0 @@ |
@@ -67,3 +67,9 @@ 'use strict'; | ||
} | ||
return props.children(wizardContext.getStep()); | ||
const contextRef = React.useRef(null); | ||
const stepRef = React.useRef(null); | ||
if (contextRef.current !== wizardContext) { | ||
contextRef.current = wizardContext; | ||
stepRef.current = wizardContext.getStep(); | ||
} | ||
return props.children(stepRef.current); | ||
}; | ||
@@ -70,0 +76,0 @@ |
{ | ||
"name": "react-wizard-primitive", | ||
"version": "1.1.1", | ||
"description": "A react wizard primitive - built with hooks!", | ||
"version": "1.1.2", | ||
"description": "A react wizard primitive without UI restrictions - hooks and render props API available!", | ||
"main": "dist/index.js", | ||
@@ -21,2 +21,3 @@ "module": "dist/index.esm.js", | ||
"hooks", | ||
"multistep", | ||
"primitive", | ||
@@ -23,0 +24,0 @@ "typescript" |
@@ -140,3 +140,3 @@ <h1 align="center"> | ||
You can _optionally_ provide a render prop, which gets passed the same values that _useWizard_. | ||
You can _optionally_ provide a render prop, which gets passed the same values that _useWizard_ returns. | ||
@@ -200,3 +200,3 @@ ### WizardStep | ||
A step is the main data structure for the wizard. | ||
It contains the following informations: | ||
It contains the following information: | ||
@@ -203,0 +203,0 @@ ### index |
16876
183