Skip to content

Commit 4cf541f

Browse files
authored
Make examples in README more precise (#94)
Close #91 It makes all examples in README correct and more accurate to what we will get after running the plugin.
1 parent 131ea10 commit 4cf541f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Use Pug templates to write react components.
1010
Write your components this way:
1111

1212
```jsx
13-
export default const ReactComponent = props => pug`
13+
export const ReactComponent = props => pug`
1414
.wrapper
1515
if props.shouldShowGreeting
1616
p.greeting Hello World!
@@ -22,11 +22,11 @@ export default const ReactComponent = props => pug`
2222
And it will be transpiled into:
2323

2424
```jsx
25-
export default const ReactComponent = props => (
25+
export const ReactComponent = props => (
2626
<div className="wrapper">
27-
{props.shouldShowGreeting && (
28-
<p className="greeting">Hello World</p>
29-
)}
27+
{props.shouldShowGreeting ? (
28+
<p className="greeting">Hello World!</p>
29+
) : null}
3030
<button onClick={props.notify}>Click Me</button>
3131
</div>
3232
)
@@ -59,7 +59,7 @@ Full information of the syntax you can find in official documentation: [pugjs.or
5959
const Component = props => pug` //- const Component = props => (
6060
div //- <div>
6161
if props.amount > MAX_AMOUNT //- {props.amount > MAX_AMOUNT ? (
62-
OtherComponent(fluid crucial) //- <OtherComponent fluid crucial />
62+
OtherComponent(fluid crucial) //- <OtherComponent fluid={true} crucial={true} />
6363
else //- ) : (
6464
p You can set bigger amount ;) //- <p>You can set bigger amount ;)</p>
6565
//- )}
@@ -86,7 +86,7 @@ const Component = props => pug` //- const Component = props => (
8686
//-
8787
OtherComponent( //- <OtherComponent
8888
...props.objectWithPropsForChild //- {...props.objectWithPropsForChild}
89-
fluid //- fluid
89+
fluid //- fluid={true}
9090
data-array=[1, 2, 3] //- data-array={[1, 2, 3]}
9191
) //- />
9292
//- </div>
@@ -232,7 +232,7 @@ _Coming soon..._
232232
* We can't use dots in component names because pugjs treats everything after dot as a className. For example, `React.Fragment` becomes `<React className="Fragment" />`, not `<React.Fragment />`
233233

234234
A nice workaround is made by [babel-plugin-transform-jsx-classname-components](https://github.com/ezhlobo/babel-plugin-transform-jsx-classname-components). Just add it to `.babelrc`:
235-
235+
236236
```rc
237237
{
238238
"plugins": [
@@ -268,7 +268,7 @@ The short answer is no and we are not going to implement that in near future. Ta
268268
* Prefix: `<template lang="pug">`
269269
* Suffix: `</template>`
270270
* Places Patterns: `+ taggedString("pug")`
271-
271+
272272
4. Click "OK" and "Apply"
273273

274274
#### Atom

0 commit comments

Comments
 (0)