Skip to content
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

Open
RusinovAnton opened this issue Mar 12, 2019 · 11 comments
Open

Migration to React 16.x context #38

RusinovAnton opened this issue Mar 12, 2019 · 11 comments
Assignees
Milestone

Comments

@RusinovAnton
Copy link

Hello, thanks for the great library.

Is it planned to migrate to the latest React versions, especially using stable context API?

@cheungpat
Copy link

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.

@github-actions
Copy link

github-actions bot commented Apr 7, 2020

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.

@paulocarvalho2899
Copy link

I have the same problem, it is important to do the migration!

@cheungpat is a good "solution", but it's only temporary

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity.

@ryhinchey
Copy link
Contributor

sorry for the late response here. We'll be updating to the latest React Context api soon

@araymond11
Copy link

I have the same problem too, is it still supposed to be fixed soon ?
Thanks !

@dmossie
Copy link

dmossie commented Nov 5, 2021

Hey I am also getting this warning - would be great to have an update!

@paulosalvatore
Copy link

paulosalvatore commented Jul 7, 2022

@ryhinchey Any news?

@github-actions
Copy link

github-actions bot commented Aug 5, 2023

This issue is stale because it has been open 30 days with no activity.

@JAKWeRD
Copy link

JAKWeRD commented Mar 25, 2024

Hello, what has happened to this? Still getting this error.

Copy link

This issue is stale because it has been open 30 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests