-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migration to React 16.x context #38
Comments
As for React 16.x context, I created my own WizardContext which allows my code to get the albus context via the new 16.x API: // WizardContext.tsx
import React from "react";
import PropTypes from 'prop-types';
import { WizardContext as AlbusContext } from 'react-albus';
export const WizardContext = React.createContext<AlbusContext>(
{} as AlbusContext
);
export const WizardProvider: React.FC = ({children}, context) => {
return (
<WizardContext.Provider value={context.wizard}>
{children}
</WizardContext.Provider>
);
};
WizardProvider.contextTypes = {
wizard: PropTypes.object
}; Then in the wizard tsx: import { WizardProvider } from './WizardContext';
// ...
<Wizard>
<WizardProvider>
<Steps>
// ... Then in a child component tsx: import { WizardContext } from '../contexts/WizardContext';
// ...
const {
next
} = useContext(WizardContext);
// ...
<button onClick={next}>Next</button> Hope this helps. Still hoping 16.x context support will be added soon. |
This issue is stale because it has been open 30 days with no activity. Remove no-issue-activity label or comment or this will be closed in 5 days. |
I have the same problem, it is important to do the migration! @cheungpat is a good "solution", but it's only temporary |
This issue is stale because it has been open 30 days with no activity. |
sorry for the late response here. We'll be updating to the latest React Context api soon |
I have the same problem too, is it still supposed to be fixed soon ? |
Hey I am also getting this warning - would be great to have an update! |
@ryhinchey Any news? |
This issue is stale because it has been open 30 days with no activity. |
Hello, what has happened to this? Still getting this error. |
This issue is stale because it has been open 30 days with no activity. |
Hello, thanks for the great library.
Is it planned to migrate to the latest React versions, especially using stable context API?
The text was updated successfully, but these errors were encountered: