Giter VIP home page Giter VIP logo

react's Issues

Configure peerDependencies to avoid duplicated React instances in bundles

React instances are duplicated when using cycle/react, because cycle/react defines react as a regular dependency instead of a peerDependency in package.json. This not only bloats the bundle files up, but also makes writing extensions harder, because in some low-level cases, these instances can mix up (especially when I'm playing with JSX pragmas). Currently these are regular dependencies package.json:

  "dependencies": {
    "@cycle/run": "5.x.x",
    "react": "16.5.x",
    "xstream": "11.x.x"
  },

I think all of these should be in the peerDependencies block.

No render when combining non-trivial components and having drivers

Full code here: https://codesandbox.io/s/quirky-butterfly-0pdjd?file=/src/index.ts

function main(sources: any) {
  const counter = Counter(sources, xs.of(2));
  const other = Counter(sources, xs.of(1));
  return {
    react: xs
      .combine(counter.DOM, other.DOM)
      .map((els) => h("div", els))
  };
}

const App = makeComponent(main, {});

render(h(App), document.getElementById("app"));

Given the code above, I get an empty webpage with no components rendered, even though the DOM stream does fire with valid component data.

I can make this work by either removing drivers:

makeComponent(main)

or by replacing my Counter components with something trivial:

.combine(
  xs.of(h("div", "one")),
  xs.of(h("div", "two"))
)

I suspect that there is a bug somewhere in makeComponent code where it branches on non-null drivers argument, but I haven't done any actual investigation.

No event listener when importing from other package

I'm having some problems using cycle-react in my own components if these are imported from other packages.

When importing the hyperscript function directly from cycle/react everything works fine. But when I import a HOC from another package, things start to not work as expected.

For what I can debug, ForwardRefs are created ok. However, no event listener is attached to the html element. In this screenshot, the element in the second button appears with no handler using react devTools.

I've created a repo that reproduces this issue using a lerna monorepo.

no-handler

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.