stampit-org / react-stamp Goto Github PK
View Code? Open in Web Editor NEWComposables for React.
Composables for React.
In your exemple, you're using rest+spread on behavior
object.
import reactStamp from 'react-stamp';
export default ({
React,
Button,
Text,
}, ...behaviors) => (
reactStamp(React).compose({
state: {
showText: false,
clickable: false
},
render () {
const { clickable, showText } = this.state;
const { text } = this.props;
return (
<div>
<Button
disabled={!clickable}
onClick={() => this.onClick && this.onClick()}
value='click me'
/>
<Text
value={showText && text}
/>
</div>
);
}
}, ...behaviors)
);
But as fas as I understand react-stamp
composition, it should be possible to just send behavior
.
import reactStamp from 'react-stamp';
export default ({
React,
Button,
Text,
}, behaviors) => (
reactStamp(React).compose({
state: {
showText: false,
clickable: false
},
render () {
const { clickable, showText } = this.state;
const { text } = this.props;
return (
<div>
<Button
disabled={!clickable}
onClick={() => this.onClick && this.onClick()}
value='click me'
/>
<Text
value={showText && text}
/>
</div>
);
}
}, behaviors)
);
Did I miss something?
Branch | Build failing π¨ |
---|---|
Dependency | babel-cli |
Current Version | 6.24.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-cli is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Hello,
i've spent hours to figure out what's wrong with my react project and it appears that react-stamp is incompatible with stamp-utils 1.3.1 (or maybe 1.3.1 has bug)
Actually, with this simple component,
const C = reactStamp(React).compose({
render() {
return <div>My react stamp component</div>
}
})
the compose
method remove render
because stamp-utils.isDescriptor({ render() {...} }) return true with version 1.3.1 but not with version 1.2.4.
Could you please change carret with tilde on stamp-utils to avoid to use 1.3.1 version ?
"dependencies": {
"lodash": "^4.6.1",
"stamp-utils": "~1.2.4"
},
I know stampit v2 has dropped IE8 support.
Since this library is specifically for React, does it support IE8, as React does?
Hi,
displayName
is missing from the reactDesc
interface
in docs/api.
Hey, guys!
Thanks for the awesome library!
I find this approach way more better than common one, just one thing.. How to enable hot-module-reload with webpack?
Thanks!
A recent issue over at the React repo (facebook/react#5047) got me thinking.
When I wrote this library originally (react-stampit), I wanted to enforce composition logic similar to React.createClass
. More about this is described in the docs here. But after reading and thinking about the above React issue, maybe this is the wrong thing to do. What if react-stamp simply stuck to the composition logic layed out in the stamp spec while providing the React-like API? No method wrapping, no duplicate key checks, just assign/merge all properties with last-in priority.
I'm having trouble coming up with examples favoring the current composition logic.
cc @ericelliott
Branch | Build failing π¨ |
---|---|
Dependency | babel-core |
Current Version | 6.23.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-core is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
With the new composables specification the following:
const container = ({
React,
Button,
Text,
}, ...behaviors) => (
reactStamp(React).compose({
state: {}
render(){}
})
);
const MyComponent = container({
React,
Button: button(React),
Text: text(React),
}, buttonBehavior);
can be now improved to
const MyComponent = reactStamp.compose(
React,
Button: button(React),
Text: text(React),
buttonBehavior,
{
state: {},
render(){}
});
or even
const MyComponent = reactStamp
.compose(React)
.compose({
Button: button,
Text: text
})
.compose(buttonBehavior)
.compose({
state: {},
render(){}
});
Something like that. Up to you actually. :)
@troutowicz what do you think?
Now when React Hooks are available providing composability out of the box, it doesn't seem that stamps provide any benefit. According to NPM, there is still a couple of downloads, some legacy projects I assume. Besides, there was no activity since 2016 in regards to issues or anything.
Should we deprecate this project?
Branch | Build failing π¨ |
---|---|
Dependency | react-addons-test-utils |
Current Version | 15.5.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As react-addons-test-utils is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | babel-eslint |
Current Version | 7.1.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-eslint is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
Main change is just an option to disable the codeframe (added in v7.1.1) for html output and more (thanks to @Couto).
{ "parser": "babel-eslint", "parserOptions": { "codeFrame": false }, "extends": "eslint:recommended" }
lodash
instead of lodash.pickby
. (#435) (wtgtybhertgeghgtwtg)*
" (#426) (Henry Zhu)*
(#421) (Henry Zhu)The new version differs by 17 commits .
4db4db5
7.2.0
4499412
Use lodash
instead of lodash.pickby
. (#435)
a2c3b30
[flow] Process polymorphic type bounds on functions (#444)
515adef
Add option to disable code frame. (#446)
ce66e73
Merge pull request #447 from kaicataldo/clean-up-eslint
b49ab20
Updates ESLint version/remove unnecessary config
702d6b8
Remove broken ESLint tests
6b4c4ca
Upgrade outdated dependencies
bdeb86f
remove deprecated rule examples [skip ci]
52b4a13
update readme [skip ci]
0e5aca3
chore(package): update eslint-config-babel to version 6.0.0 (#433)
781dc77
Update to use Node 4 features (#425)
265d219
chore(package): update eslint-config-babel to version 4.0.0 (#430)
e6af5c5
add badges [skip ci]
a91a9d0
Revert "use *
" (#426)
There are 17 commits in total. See the full diff.
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
module.js:340
throw err;
^
Error: Cannot find module '.'
Branch | Build failing π¨ |
---|---|
Dependency | react |
Current Version | 15.5.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As react is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | babel-preset-stage-2 |
Current Version | 6.22.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-preset-stage-2 is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
In addition to the excellent improvements in #17, I think it would be really helpful to see a real code example (even if contrived) of using stamp.compose()
directly in the README.
Branch | Build failing π¨ |
---|---|
Dependency | rimraf |
Current Version | 2.5.4 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As rimraf is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
The new version differs by 5 commits .
5b661e4
v2.6.0
c09915f
update tap
d53235d
Make rimraf.sync 10000% more reliable on Windows
e8b10a7
Retry on EBUSY et al on non-windows platforms as well
0fac5f7
Add --no-glob option to cli
See the full diff.
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Just an idea, I'm not sure if it doesn't collide with something else at this point, but what about defining component like this:
const MyComponent = () => ({
render() {
}
});
export default ReactStamp.compose(
MyComponent, Focusable, Emittable
);
It means that it would have to call passed function to a compose
to obtain a descriptor. Along the way it would be possible to read displayName
of that function and append into final descriptor. I also like it this way as final composition is more readable.
Branch | Build failing π¨ |
---|---|
Dependency | babel-loader |
Current Version | 6.2.10 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-loader is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
The new version differs by 10 commits .
877e956
6.3.0
4b3bafa
FS caching improvements (#375)
0b19a6d
Update loader-utils dependecy to ^0.2.16 (#371)
15881f4
Add env query parameter. (#368)
e9e3702
Update yarn.lockk
707f31c
chore(package): update eslint-config-babel to version 6.0.0 (#360)
5657f48
chore(package): update eslint-config-babel to version 5.0.0 (#359)
757002a
Remove plugin-babel (#358)
a7e16da
Update eslint-config-babel to the latest version π (#357)
3900952
Update CHANGELOG.md
See the full diff.
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | react-addons-test-utils |
Current Version | 15.4.2 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As react-addons-test-utils is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
React.createClass
. Points users to create-react-class instead. (@acdlite in d9a4fa4)React.PropTypes
. Points users to prop-types instead. (@acdlite in 043845c)ReactDOM
together with ReactDOMServer
. (@wacii in #9005)react-dom/test-utils
, which exports the React Test Utils. (@bvaughn)componentWillUnmount
was not called for children. (@gre in #8512)react-test-renderer/shallow
, which exports the shallow renderer. (@bvaughn)peerDependencies
so that addons continue to work indefinitely. (@acdlite and @bvaughn in 8a06cd7 and 67a8db3)React.createClass
and React.PropTypes
(@acdlite in 12a96b9)react-addons-test-utils
is deprecated. Use react-dom/test-utils
and react-test-renderer/shallow
instead. (@bvaughn)There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
The README could be better.
React.createClass
2.0BDC example: http://codepen.io/troutowicz/pen/BoZqXX?editors=001
Branch | Build failing π¨ |
---|---|
Dependency | babel-preset-es2015 |
Current Version | 6.22.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-preset-es2015 is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | react |
Current Version | 15.5.2 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As react is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | react |
Current Version | 15.5.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As react is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Hi
there's a way to avoid the use of bind for custom handler?
http://esnextb.in/?gist=5c9399dfdde739723b7f3f22a32157dd
import React from 'react';
import ReactDOM from 'react-dom';
import reactStamp from 'react-stamp';
const container = {
state:{
val: 'click me'
},
clickMe(evt) {
this.setState({val: 'clicked'});
},
render() {
const newHandler = this.clickMe.bind(this);
return (
<div className="clearfix">
<a onClick={newHandler}>{this.state.val}</a>
</div>
);
}
}
const DummyComponent = reactStamp(React).compose(container);
const domHandle = document.getElementById('js-react-entry');
ReactDOM.render(<DummyComponent />, domHandle);
it seems that in this way it doesn't works
import React from 'react';
import ReactDOM from 'react-dom';
import reactStamp from 'react-stamp';
const container = {
state:{
val: 'click me'
},
clickMe(evt) {
this.setState({val: 'clicked'});
},
render() {
const handler = this.clickMe;
return (
<div className="clearfix">
<a onClick={handler }>{this.state.val}</a>
</div>
);
}
}
const DummyComponent = reactStamp(React).compose(container);
const domHandle = document.getElementById('js-react-entry');
ReactDOM.render(<DummyComponent />, domHandle);
Branch | Build failing π¨ |
---|---|
Dependency | react |
Current Version | 15.4.2 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As react is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
React.createClass
. Points users to create-react-class instead. (@acdlite in d9a4fa4)React.PropTypes
. Points users to prop-types instead. (@acdlite in 043845c)ReactDOM
together with ReactDOMServer
. (@wacii in #9005)react-dom/test-utils
, which exports the React Test Utils. (@bvaughn)componentWillUnmount
was not called for children. (@gre in #8512)react-test-renderer/shallow
, which exports the shallow renderer. (@bvaughn)peerDependencies
so that addons continue to work indefinitely. (@acdlite and @bvaughn in 8a06cd7 and 67a8db3)React.createClass
and React.PropTypes
(@acdlite in 12a96b9)react-addons-test-utils
is deprecated. Use react-dom/test-utils
and react-test-renderer/shallow
instead. (@bvaughn)There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | eslint |
Current Version | 3.14.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As eslint is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
no-extra-parens
incorrect precedence (fixes #7978) (#7999) (alberto)template-tag-spacing
rule (fixes #7631) (#7913) (Jonathan Wilsson)The new version differs by 17 commits .
8ea98f9
3.15.0
77b5cb7
Build: package.json and changelog update for 3.15.0
f2a3580
Fix: no-extra-parens
incorrect precedence (fixes #7978) (#7999)
d6b6ba1
Fix: no-var should fix ForStatement.init (#7993)
99d386d
Upgrade: Espree v3.4.0 (#8019)
42390fd
Docs: update README.md for team (#8016)
d7ffd88
Chore: enable template-tag-spacing on ESLint codebase (#8005)
f2be7e3
Docs: Fix typo in object-curly-newline.md (#8002)
df2351a
Docs: Fix misleading section in brace-style documentation (#7996)
5ae6e00
Chore: avoid unnecessary feature detection for Symbol (#7992)
5d57c57
Chore: fix no-else-return lint error (refs #7986) (#7994)
62fb054
Chore: enable no-else-return on ESLint codebase (#7986)
c59a0ba
Update: add ignoreRestSiblings option to no-unused-vars (#7968)
5cdfa99
Chore: enable no-unneeded-ternary on ESLint codebase (#7987)
fbd7c13
Update: ensure operator-assignment handles exponentiation operators (#7970)
There are 17 commits in total. See the full diff.
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
It's something that ES6 classes kinda suffer from that all methods you want to pass as a callback has to be manually bound to this
. It seems to me that stamps kinda suffer same thing compared to React.createClass
that is doing autobind.
So I am wondering how to approach this in here. Manual bind in initializer or directly in callback seems just awkward to me. However full autobind might have some unwanted effects too with mixing various behavior to the stamp, some of those methods might want to keep their original context.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.