Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hamlim/babel-slot-fill

A simple babel plugin to allow extremely composable React components.
https://github.com/hamlim/babel-slot-fill

babel magic react

Last synced: 10 days ago
JSON representation

A simple babel plugin to allow extremely composable React components.

Awesome Lists containing this project

README

        

# Babel-Slot-Fill

Babel Slot Fill is a simple babel plugin that allows you to write React components like this:

```JSX
const Heading = withSlots(props => (



));

const MyApp = props => (



Title





);
```

which compiles out to:

```JSX
const Heading = props => (

{props.title}

);

const MyApp = props => (

Title} />

);
```

This gives you the developer experience of composing components while also allowing you to pass in more than just `children` to
your components.

## How to use

First install:

```Javascript
yarn add babel-slot-fill
```

then add to your `.babelrc` file:

```JSON
{
"plugins": [
"babel-slot-fill"
]
}
```