We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
connect react basic logic to view
view life cycle function(wrap hooks) hooks react basic runtime
const Didact = { createElement, render } function createElement(type, props, ...children) { return { type, props: { ...props, children: children.map(child => typeof child === 'object' ? child : createTextElement(child)) } } } function createTextElement(text) { return { type: 'TEXT_ELEMENT', props: { nodeValue: text, children: [] } } } function render(element, container) { const dom = element.type === 'TEXT_ELEMENT' ? element.createTextElement('') : document.createElement(element) element.props.children.forEach(child => render(child, dom)) // add props to element const isProperty = key => key !== 'children' Object.keys(element.props) .filter(isProperty) forEach(name => dom[name] = element.props[name]) container.appendChild(dom) } /** @jsx Didact.createElement */ const element = ( <div id='foo'> <a>bar</a> <b /> </div> ) const container = document.getElementById('root') ReactDOM.render(element, container)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
step
key details
diff
hooks
connect react basic logic to view
Build my own react
createElement and render function
Step 3: curcurrent mode
The text was updated successfully, but these errors were encountered: