Closed frnk94 closed 8 years ago
I'm -1 on this patch; passing functions around as values doesn't seem like a good approach. Consider passing the results of those functions around instead.
This functions is uses by my frontend (React components) so i can't just pass the values of the function because it differ according to its state. This function also need to be calculated backend from our ORM
So if I understand you correctly, you want to append functions to process.env
to make them available globally and consume them in your components?
Is there a reason you need to build the functions on the server and can't just pass the data to the client?
This is why I need to pass a function I want to have constancy in my code base. This function is used by my backend & frontend. the value pass to the function depend on the state of my application.
exemple:
React.createClass({
getInitialState() {
return {
number: 0,
}
},
calculatePrice() {
process.env.getPrice(this.state.number);
},
render() {
return (
<div>{this.calculatePrice()}</div>
);
},
});
I feel this complicates things too much and there's very little interest from others. While I appreciate the effort you've put into this I'd rather be forward and close this PR than leave it open and unanswered. Thanks a bunch, but this is not going to land as of now.
I use envify to send my configs and some of them are functions. The
JSON.stringify(value)
return undefined when value is a function.