sAlert as a pure React component

Meteor sAlert package rewritten as a pure React component, check it out:

Code: https://github.com/juliancwirko/react-s-alert
Demo: http://react-s-alert.jsdemo.be/
Demo code: https://github.com/juliancwirko/react-s-alert-demo

It needs testers :wink:

6 Likes

oh man, this is excellent!

1 Like

Why would I use this instead of your other package that works fine within a React app?

juliancwirko:s-alert
juliancwirko:s-alert-stackslide

<head>
    <title>Example</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>
  <div id="react-root"></div>
  {{> sAlert}}
</body>

MyComponent = React.createClass({
  getInitialState: function() {
    return {
      name: '',
      errors: {}
    };
  },

  fireAlert: function(e) {
    sAlert.success('Working fine.');
  },
});

I ask because I just added your other package this morning to my project and this newer one just seems infinitely more complicated.

You can remove the Blaze package from your project.

1 Like

Why would I switch them? What benefit do I get from installing this version? Looks like more configuration for no actual benefit.

I think most of the configuration is for webpack and not for the sAlert component itself.
The benefit is that you can remove blaze from the project, making it smaller and faster to load. If the app is not that big or blaze is required for other packages too, you can keep the original one.

1 Like

Yes, this is just a React component, you can use it with all kind of apps which uses React, not only with Meteor. It is also useful when you don’t want to use Blaze at all in your Meteor app.

The usage is really simple, maybe I should improve the docs :wink:

But yes, you can also use s-alert.meteor.com (sAlert Blaze package) in Meteor app with React. You need to remember that it will need Blaze too.

How would you integrate this into a Meteor project?

You can treat it as a normal Npm package (https://www.npmjs.com/package/react-s-alert). So it should work just like the other React components. Also it could be simpler with Meteor 1.3. Unfortunatelly I didn’t test it with Meteor yet :confused: I’ll try asap.