The Container/View Pattern in this article, isn't this MVC?
You could argue it's a variation thereof, more like MVVC (Model View ViewController) maybe. In React you only really have the View layer. In this case, there's two views, a 'functional' view (the ViewController) and the 'presentation' view (the View itself). I guess the main difference is that in MVC, the view and controller are two separated entities (side-by-side), while in React it's embedded (Controller wraps aro…
Simple React Patterns
81–87 of 87 posts
Re: Simple React Patterns
#82Two things I don't like about the approach taken with these specific examples (and they're related): - It's harder to see the structure of a page when the parts are composed functionally instead of structurally (i.e. explicit nesting); but functional composition is required because the next step down from components are DOM elements - This approach makes consistent styling of a large application difficult because it…
Re: Simple React Patterns
#83Re: Simple React Patterns
#84I am always intrigued when I come across an article like this, after having done 2+ years of React development, and have never seen these patterns (Provider Pattern), nor seen them debated (Render Props). I do pay attention to the community here and there, and constantly poke around open source react libraries. I tend to bring in patterns from iOS development, such as Delegates, especially when using React Native, an…
Re: Simple React Patterns
#85Earlier quoted context omitted.
Set a variable... set a property in the component state? Or set a static variable on the class?
I use a static var on the class. componentDidMount() { if (!this.unmounted) ... } componentWillUnmount() { this.unmounted = true }
Re: Simple React Patterns
#86Re: Simple React Patterns
#87Earlier quoted context omitted.
actually once redux is introduced to react it's very very very functional.. so hold the sadness
React is functional even without Redux :-) Look at the Reason team, with their Reason-React implementation. Cheng Lou seems to actively dislike a single store that Redux is, and, if anything, co-locates stores to stateful components.