acdlite / acdlite/realm

Allow stateless view component

Aperta
#2 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
170
Fork
5
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I tried to run the example in `README.md` but i got:

```
warning.js:45 Warning: view(...): No `render` method found on the returned component instance: you may have forgotten to define `render`, returned null/false from a stateless component, or tried to render an element whose type is a function that isn't a React component.warning @ warning.js:45ReactCompositeComponentMixin.mountComponent @ ReactCompositeComponent.js:166ReactCompositeComponent_mountComponent @ ReactPerf.js:66ReactReconciler.mountComponent @ ReactReconciler.js:37ReactCompositeComponentMixin.mountComponent @ ReactCompositeComponent.js:225ReactCompositeComponent_mountComponent @ ReactPerf.js:66ReactReconciler.mountComponent @ ReactReconciler.js:37ReactCompositeComponentMixin.mountComponent @ ReactCompositeComponent.js:225ReactCompositeComponent_mountComponent @ ReactPerf.js:66ReactReconciler.mountComponent @ ReactReconciler.js:37mountComponentIntoNode @ ReactMount.js:266Mixin.perform @ Transaction.js:136batchedMountComponentIntoNode @ ReactMount.js:282Mixin.perform @ Transaction.js:136ReactDefaultBatchingStrategy.batchedUpdates @ ReactDefaultBatchingStrategy.js:62batchedUpdates @ ReactUpdates.js:94ReactMount._renderNewRootComponent @ ReactMount.js:476ReactMount__renderNewRootComponent @ ReactPerf.js:66ReactMount._renderSubtreeIntoContainer @ ReactMount.js:550ReactMount.render @ ReactMount.js:570React_render @ ReactPerf.js:66(anonymous function) @ app.js:92(anonymous function) @ app.js:94(anonymous function) @ app.js:95(anonymous function) @ bundle.js:1007__webpack_require__ @ bundle.js:521fn @ bundle.js:76(anonymous function) @ multi_main:3(anonymous function) @ bundle.js:551__webpack_require__ @ bundle.js:521(anonymous function) @ bundle.js:544(anonymous function) @ bundle.js:547
ReactCompositeComponent.js:587 Uncaught TypeError: inst.render is not a function
```

so replaced the stateless component with:

```
class view extends React.Component {
render(){
const { model, dispatch } = this.props
return (


Count: {model}


dispatch({ type: INCREMENT }) }>+
dispatch({ type: DECREMENT }) }>-

)
}
}
```

and it worked.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.