1.6.1 • Published 6 months ago

jsx-sfc.macro v1.6.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

jsx-sfc.macro

Babel macro for compile and enhance the limitation of jsx-sfc runtime code.

Usage

import React, { useState } from 'react';
import styled from 'styled-components';
import sfc from 'jsx-sfc.macro';

const App = sfc({
  Component() {
    const [user, setUser] = useState('foo');
    return { user, onClick: () => setUser('bar') };
  },

  render: ({ data, styles: { Wrapper } }) => (
    <Wrapper>
      <button onClick={data.onClick}>{data.user}</button>
    </Wrapper>
  ),

  styles: {
    Wrapper: styled.div`
      background-color: #fff;
    `
  }
});

How it works

The same as babel-plugin-jsx-sfc.

License

MIT

1.6.1

6 months ago

1.6.0

2 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.7

3 years ago

1.3.6

3 years ago

1.3.8

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.3.0-alpha.5

3 years ago

1.3.0-alpha.4

3 years ago

1.3.0-alpha.3

3 years ago

1.3.0-alpha.2

3 years ago

1.3.0-alpha.1

3 years ago

1.2.0

3 years ago