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

Upgrade isomorphic-style-loader to React 16.6.0 and use new Context API #141

Merged
merged 2 commits into from
Feb 18, 2019
Merged

Conversation

mglace
Copy link
Contributor

@mglace mglace commented Nov 5, 2018

I want to take advantage of the new React.Component.contextType property in my React application but it requires React 16.6.0. I'm not able to upgrade because of a dependency on isomorphic-style-loader which still uses the legacy context API. Here is a proposed change on how the isomorphic-style-loader can leverage the new React context API.

Usage:

import StyleContext from 'isomorphic-style-loader/lib/styleContext';

class App extends React.PureComponent {
  static propTypes = {
    children: PropTypes.element.isRequired,
  };

  render() {
    const css = new Set();
    const insertCss = (...styles) => styles.forEach(style => css.add(style._getCss()));

    return (
      <StyleContext.Provider value={{ insertCss }}>
        {React.Children.only(this.props.children)}
      </StyleContext.Provider>
    );
  }
}

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 84.211% when pulling eb6d190 on mglace:master into 0c49766 on kriasoft:master.

@Dakkers
Copy link

Dakkers commented Nov 28, 2018

@frenzzy could we get this merged, and drop support for Node 4, 5 in Travis? they've been past their end-of-life for quite some time, and even Node 6 is reaching its end of life soon.

@piglovesyou
Copy link
Contributor

I made a one before but this is better.

@koistya @frenzzy Because of silence like this thread, React Starter Kit is getting old. I do like RSK. Let's take some action before it's too late :)

@piglovesyou
Copy link
Contributor

@koistya @frenzzy Please find someone who can merge this PR if you don't have time, please.

@frenzzy frenzzy merged commit 334603a into kriasoft:master Feb 18, 2019
@frenzzy
Copy link
Member

frenzzy commented Feb 18, 2019

Thank you!

@piglovesyou
Copy link
Contributor

@frenzzy Thank you! Can I ask when do you plan to release it?

@frenzzy frenzzy mentioned this pull request Feb 18, 2019
@frenzzy
Copy link
Member

frenzzy commented Feb 18, 2019

Released as v5.0.0 🙏 🎉

@mglace
Copy link
Contributor Author

mglace commented Feb 18, 2019

Thank you!

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

Successfully merging this pull request may close these issues.

5 participants