Skip to content

a way to proxy props #27

@titoBouzout

Description

@titoBouzout

In react I have made a component named Box which automates most of my layout needs if not all. https://github.com/titoBouzout/crippling-sorrow-styling

I use it like.. "The "Holy Grail Layout"(sticky footer)

<Box col grow>
	<Box>header</Box>
	<Box grow>content</Box>
	<Box>footer</Box>
</Box>

In react this works somewhat as follows:

function Box(props) {
	return React.createElement('div', proxy_props(props))
}
function proxy_props(props){
	if(props.col){
		props.className = 'column'
		delete props.col 
	}
	return props
}
  1. In mobx-jsx I was trying to recreate this pattern but I have been failing. I have seen two kind of errors but Im mostly sure Im doing something wrong, so I would like to ask for an example on using createComponent to recreate that pattern.

MISSING_EXPORT Error: 'assignProps' is not exported by www.client\node_modules\mobx-jsx\dist\index.js, imported by www.client\jsx\@layout\sidebar-left.jsx

  1. [removed]

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions