Skip to content

Conversation

@phantomics
Copy link

Originally, Panic only supported the assignment of components to top-level variables. Now, you can assign components to the properties of objects. (panic:defcomponent (@ my-object property) ...) becomes myObject.property = React.createClass(...).

The current version of Panic allows for components to be included within other components by explicitly calling the constructor methods for the component classes, for example TodoList({ ... }), but React throws error messages when used this way. Instead of using the React.DOM functions to create instances of HTML DOM objects, React.createElement is now used to build all types of subcomponents.

When writing component forms, React components are now differentiated from DOM objects by the presence of a leading "-" in the symbol name. When translated to Javascript, this equates to a leading capital, as per React component naming convention. Hence, (:div ...) becomes React.createElement('div', ...), while (:-todo-list ...) becomes React.createElement(TodoList, ...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants