New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-diode

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-diode

Endpoint agnostic, unidirectional data fetching for React applications

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
29
increased by16%
Maintainers
1
Weekly downloads
 
Created
Source

react-diode (alpha)

Endpoint agnostic, unidirectional data fetching for React application

Install

$ npm install react-diode

Usage example

Currently only work in server side rendering, roughly like this:

import express from 'express';
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import Diode from 'react-diode';
import HelloWorldQuery from './queries/HelloWorldQuery';

let app = express();

class AppComponent = () => {
  // guaranteed to have props = { hello: { world: 'Hello World' }}
  return (
    <div>{this.props.hello.world}</div>
  );
};

let App = Diode.createContainer(AppComponent, {
  queries: {
    hello: new HelloWorldQuery({
      world: null
    })    
  }
});

let options = {};

app.get('/', function(req, res) {
  // for now we still run .fetchData() manually
  Diode.fetchData(App, options).then(diodeResponse => {
    let response = ReactDOMServer.renderToStaticMarkup(App, { diodeResponse });

    res.send(response);
  });  
})

TODO

  • Render trigger fetch data automatically
  • Client side implementation

License

MIT

Keywords

FAQs

Package last updated on 19 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc