Git Product home page Git Product logo

alveron's Issues

react-woodworm.js.org

JS.ORG CLEANUP

Hello, it seems a js.org subdomain that was requested to target this repository (or another on this user/organisation) no longer works.
The subdomain requested was react-woodworm.js.org and had the target of rofrischmann.github.io/react-woodworm.
To keep the js.org subdomain you should add a page with reasonable content within a month so the subdomain doesn't resolve to a 404 any longer.
Otherwise the requested subdomain will be removed from JS.ORGs zonefile and the list of active subdomains.

If you are wanting to keep the js.org subdomain and have added reasonable content, YOU MUST reply to the main cleanup issue with the response format detailed at the top to keep the requested subdomain.

shouldUpdate on Consumer

It might be helpful to implement basic shallow equality checks for the Consumer component or at least add the ability to add a custom shouldUpdate method.

Connect helper

I was wondering if there's any reason for the absence of a connect helper.

Let's say i have stateful component and I want to call an effect that fetches an API on componentDidMount. How can i achieve it without hooks?

because right now i was trying to use Hooks but i get useAlveron is not a function because on import it's an object and not a function, so i suppose my react version doesn't support hooks.

"react": "16.6.3",

Force effects to call actions

Instead of exposing setState freely, we could even restrict effects more to just calling actions.
Could be great in terms of testing and separation:

const model = []
const actions = {
  addUser: (state, user) => [
    ...state,
    user
  ]
}

const effects = {
  postUser: (actions, user) => fetch("api.com/users", { 
      method: 'POST', 
      body: JSON.stringify(user)
    }).then(res => res.json()).then(actions.addUser)
}

Any plan to support typescript?

I saw there's flow in this lib but I was wondering if you plan to support typescript in the future or if you are open to receive PR about it. There's also a chance to publish a separate package on typescript types repository.

Improve documentation

We should extend the docs to explain the principles even better and to separate the API docs.
Maybe we should also use Gitbook like I usually do (fela.js.org, react-controlled-form.js.org, inline-style-prefixer.js.org).

Provide Consumer API as an object

Instead of passing everything as separate parameters, we should rather use an object to allow future additions not to extend the params even more.

// old
<Consumer>{(state, actions, effects, more, evenMore) => ...}</Consumer>
// old
<Consumer>{({ state, actions, effects, more, evenMore }) => ...}</Consumer>

It also helps to only pick the keys that are actually required without leaving blank params.

Make it work as a custom React Hook

Could look something like:

const model = []
const actions = {
  setList: (_, items) => items
}
const effects = {
  fetch: (actions) => fetch(....).then(actions.setList)
}

const Store = createStore({ model, actions, effects })

const SomeList = () => {
  const { state, effects } = useAlveron(Store)

  return (
    <div>
      {state.map(el => <div>{el}</div>)}
      <button onClick={effects.fetch} />
    </div>
  )
}

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.