Skip to content
This repository was archived by the owner on Aug 27, 2018. It is now read-only.

Introduce concept of elements as distinct from components #73

Merged
merged 1 commit into from
Jul 26, 2017

Conversation

myitcv
Copy link
Owner

@myitcv myitcv commented Jul 26, 2017

!! BREAKING CHANGE !!

One of the shortcuts I had taken until this point was to conflate the concept of a component (definition) and an element. This PR introduces the concept of an element. More precise definitions to follow in the wiki, but briefly:

  • a component is as it was before, and corresponds directly to a React component. It is the definition, potentially with props and state, of a thing that Render's
  • an element is an "instance" of a component (this definition needs to improve... to mention mounting etc)

This has the nice side effect of resolving many of the spurious re-Render's that were happening.

So changes in this PR include:

  • Introduced elements and refactored existing components to reflect that change. For core components, e.g. the component behind the <div> HTML element, we no longer declare *Def component; instead the constructor functions, e.g. react.Div(...) return an element, in this case react.DivElement
  • react.BlessElement is now react.CreateElement
  • Declaring your own component, e.g. MyCompDef, requires that methods be declared on the type MyCompDef and not *MyCompDef (docs to follow)
  • Various refactors of methods in myitcv.io/react

Less interesting:

  • Vendored github.com/gopherjs/jsbuiltin

@myitcv myitcv force-pushed the fix_comp_vs_elem branch from 1e871ea to 4f00450 Compare July 26, 2017 19:38
@myitcv myitcv changed the title [WIP] fix comp vs elem discrepancy [WIP] Introduce concept of elements as distinct from components Jul 26, 2017
@myitcv myitcv changed the title [WIP] Introduce concept of elements as distinct from components Introduce concept of elements as distinct from components Jul 26, 2017
@myitcv myitcv merged commit 14548f4 into master Jul 26, 2017
@myitcv myitcv deleted the fix_comp_vs_elem branch July 26, 2017 20:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant