Comments (7)
I've certainly been thinking about this. I was thinking more of having an API that looks something like this, but maybe there's good reason not to go with this approach:
<Box
Component={Paper}
{...boxProps}
{...paperProps} />
The Box component would pass styles based on its props, then render Paper. Curious what you think
from reflexbox.
I think it's a matter of taste.
I prefer seeing a component's own props attached to its tag.
I also prefer seeing the tags tree composition, it reduces the cognitive load for me.
So I don't have a definitive answer for this, but I'm also curious of reading others opinions.
from reflexbox.
I'm with @jgoux. I'd prefer seeing my props on the component tag.
from reflexbox.
I'm not opposed to the nested component approach. One thing that feels odd to me is that the jsx looks like two elements, but it's only generating one. Maybe that's an okay trade off in this situation.
from reflexbox.
We could also use a simple function:
import { AppBar, Paper } from "material-ui"
import { Box, Flex, box, flex } from "reflexbox"
const view = (props) =>
<Flex auto column>
<AppBar />
<Flex auto>
{box({ auto: true })(
<Paper>Left</Paper>
)}
{box({ auto: true })(
<Paper>Right</Paper>
)}
</Flex>
</Flex>
With the partial application, you can even prepare common patterns :
import { AppBar, Paper } from "material-ui"
import { Box, Flex, box, flex } from "reflexbox"
const CustomBox = box({ auto: true })
const view = (props) =>
<Flex auto column>
<AppBar />
<Flex auto>
{CustomBox(
<Paper>Left</Paper>
)}
{CustomBox(
<Paper>Right</Paper>
)}
</Flex>
</Flex>
from reflexbox.
The latest version 1.1.0
supports an is
prop to pass components or elements to render as the root. I'll take a stab at wrapper component as well at some point.
from reflexbox.
Congrats for the release ! 👍
from reflexbox.
Related Issues (20)
- withReflex() higher level component not working HOT 2
- reduce # of wrapper components HOT 1
- Different paddings on breakpoints HOT 1
- Make <Flex /> handle onClick() and similar events HOT 1
- Warning: Accessing PropTypes deprecated HOT 2
- active development HOT 1
- Depreciation Warning? HOT 1
- ReferenceError: document is not defined HOT 3
- setting things to undefined doesn't work well with cssom
- Typescript support HOT 4
- "h" prop HOT 2
- auto fill remaining space
- Full Height
- Support React 16 HOT 1
- Auto-hide in narrow device
- shim prefixing
- Problem with removed border-box and missing docs HOT 1
- What is the meaning of `breakpoints` HOT 1
- RTL support?
- SSR HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reflexbox.