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

[feat request] CreateContext API #1299

Closed
kurdin opened this issue Mar 13, 2018 · 6 comments
Closed

[feat request] CreateContext API #1299

kurdin opened this issue Mar 13, 2018 · 6 comments

Comments

@kurdin
Copy link
Contributor

kurdin commented Mar 13, 2018

Any plans for CreateContext API support like React 16 ?

https://medium.com/dailyjs/reacts-%EF%B8%8F-new-context-api-70c9fe01596b
https://medium.com/workshop-me/render-props-react-createcontext-but-how-9c8e457a90e3
https://www.jernejsila.com/2018/03/04/new-react-context-api/

maybe this can be converted to inferno ? https://github.com/rognstadragnar/preact-context-utilities

@kurdin kurdin changed the title [Feat Request] CreateContext API [feat request] CreateContext API Mar 13, 2018
@kurdin
Copy link
Contributor Author

kurdin commented Apr 11, 2018

If anyone needs this, I converted create-react-context polyfill to inferno so basic functionality of CreateContext API should work.

https://github.com/kurdin/create-inferno-context

based on this polyfill I converted unstated lib to inferno as well. This is a simple, based on component's state alternative to redux or mobx for inferno

https://github.com/kurdin/inferno-unstated

@tamb
Copy link

tamb commented May 16, 2019

If anyone needs this, I converted create-react-context polyfill to inferno so basic functionality of CreateContext API should work.

https://github.com/kurdin/create-inferno-context

Can you paste an example of how this would work within a react app using inferno-compat? What's the alias in webpack look like?

@smcatala
Copy link
Contributor

smcatala commented Jul 2, 2019

@tamb maybe something like preactjs/preact#963 (comment) ?

@smcatala
Copy link
Contributor

smcatala commented Jul 4, 2019

for the record, here is another way of adding the createContext function, e.g. for developing inferno components in storybook:
first install create-react-context for react,
then add the following inferno-compat.js script to your project, e.g. in a lib/ folder at the root of your project:

import React from 'inferno-compat'
export default React
export * from 'inferno-compat'
// bypass export of React.createContext
import createContext from 'create-react-context/lib/implementation'
export { createContext }

finally, add the following alias in the browser field of your project's package.json:

  'react': './lib/inferno-compat'
  'react-dom': './lib/inferno-compat'

@TotallWAR
Copy link

So how can i use createContext in infernojs? What is right/recommended way?

@DylanCulfogienis
Copy link

This is still an issue. Is there any action that's being taken?

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

No branches or pull requests

5 participants