Skip to content

Commit 6e7ba94

Browse files
committed
fix jsx syntax highlight
1 parent 1e80d35 commit 6e7ba94

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

P01-Build-A-Header-Component/content.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ React projects are built with Components. To build web applications with React y
1111

1212
App, Header, Logo, NavBar, NavLink, Content, Card, Footer
1313

14-
Each of these elements would be separate Components, and you would define a file for each. Component files are always named after the component they contain: `App.js`, `Header.js`, `Logo.js`, `NavBar.js`, `NavLink.js`, `Content.js`, `Card.js`, and `Footer.js`.
14+
Each of these elements would be separate Components, and you would define a file for each. Component files are always named after the component they contain: `App.js`, `Header.js`, `Logo.js`, `NavBar.js`, `NavLink.js`, `Content.js`, `Card.js`, and `Footer.js`.
1515

1616
Components can be nested. That is one Component can be the child of another Component. Rendering the parent would render the child. The components from the list above might be nested in this way:
1717

@@ -104,19 +104,19 @@ You may have noticed that `React`, the variable imported at the top of the page,
104104

105105
JSX has rules of syntax that come with it.
106106

107-
**Rule** JSX must always have a top level node.
107+
**Rule** JSX must always have a top level node.
108108

109109
For example, the code below produces an error:
110110

111-
```JSX
111+
```js
112112
// Error! Sibling nodes
113113
<h1>Hello</h1>
114114
<p>World</p>
115115
```
116116

117117
Whereas this code will not produce an error:
118118

119-
```JSX
119+
```js
120120
// Good! has a single top level element
121121
<div>
122122
<h1>Hello</h1>
@@ -208,20 +208,20 @@ Since the Component doesn't have any child Components you can use a self-closing
208208

209209
This is another **rule** of the JSX Language. Empty tags can be written as a single tag ending with `/`.
210210

211-
**Challenge:** If you're not running your React project do it now and check out your work in the browser.
211+
**Challenge:** If you're not running your React project do it now and check out your work in the browser.
212212

213-
- Using the terminal navigate to your project directory.
213+
- Using the terminal navigate to your project directory.
214214
- In terminal run: `yarn start`bash
215215

216-
You should only see the page title at the top, it's the only thing your App component is rendering at the moment.
216+
You should only see the page title at the top, it's the only thing your App component is rendering at the moment.
217217

218-
**Challenge:** Add the logo to the page.
218+
**Challenge:** Add the logo to the page.
219219

220-
To do this you'll need to add a new tag. Add an `<img />` tag. Notice the tag ends with a `/`.
220+
To do this you'll need to add a new tag. Add an `<img />` tag. Notice the tag ends with a `/`.
221221

222-
Add the src attribute and set the value to logo.
222+
Add the src attribute and set the value to logo.
223223

224-
```JSX
224+
```js
225225
<img src={logo} />
226226
```
227227

P02-Building-Content/content.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function POPOSSpace() {
116116
export default POPOSSpace
117117
```
118118

119-
There are a few things missing here but you will revisit this shortly and pick up those details. You used the React Logo as a place holder for images that will come in the future.
119+
There are a few things missing here but you will revisit this shortly and pick up those details. You used the React Logo as a place holder for images that will come in the future.
120120

121121
For now import `POPOSSpace` into to your `POPOSList`.
122122

@@ -158,7 +158,7 @@ Also, notice how your project is structured.
158158
- POPOSSpace
159159
- POPOSSpace
160160

161-
If you imagine your project as tree structure you can see that you have components nested within components similar to the HTML DOM.
161+
If you imagine your project as tree structure you can see that you have components nested within components similar to the HTML DOM.
162162

163163
# Add some Local Image Files
164164

@@ -190,9 +190,9 @@ function POPOSSpace() {
190190
return (
191191
<div>
192192
<img src={`${process.env.PUBLIC_URL}images/50-california-st.jpg`}
193-
width="300"
194-
height="300"
195-
alt="50 Califonia St."
193+
width="300"
194+
height="300"
195+
alt="50 Califonia St."
196196
/>
197197
<h1>Name...</h1>
198198
<div>Address...</div>
@@ -204,7 +204,7 @@ function POPOSSpace() {
204204
>
205205
```
206206

207-
Note! Here you set the path to an image by combing a variable and a string. This is a JavaScript expression and must be enclosed in `{...}`.
207+
Note! Here you set the path to an image by combing a variable and a string. This is a JavaScript expression and must be enclosed in `{...}`.
208208

209209
Your website should now look something similar to the following:
210210

@@ -242,12 +242,12 @@ The string needs to begin with the path to the public directory. React has an en
242242

243243
Last, put the variable inside `${}`:
244244

245-
```JSX
246-
<img
247-
src={`${process.env.PUBLIC_URL}images/50-california-st.jpg`}
248-
width="300"
249-
height="300"
250-
alt="Hello"
245+
```js
246+
<img
247+
src={`${process.env.PUBLIC_URL}images/50-california-st.jpg`}
248+
width="300"
249+
height="300"
250+
alt="Hello"
251251
/>
252252
```
253253

@@ -292,11 +292,11 @@ function POPOSSpace(props) {
292292
const { name, image, address } = props
293293
return (
294294
<div>
295-
<img
296-
src={`${process.env.PUBLIC_URL}images/${image}`}
297-
width="300"
298-
height="300"
299-
alt="Hello"
295+
<img
296+
src={`${process.env.PUBLIC_URL}images/${image}`}
297+
width="300"
298+
height="300"
299+
alt="Hello"
300300
/>
301301
<h1>{name}</h1>
302302
<div>{address}</div>
@@ -338,19 +338,19 @@ function POPOSList() {
338338

339339
The values for props are defined as attributes. The names here must match the names used within the component! Earlier you used: name, image, and address. These are the names that must be used here.
340340

341-
Compare the two components:
341+
Compare the two components:
342342

343343

344344

345-
```JSX
345+
```js
346346
// In POPOSList.js
347347
<POPOSSpace
348348
name="50 California Street" // name
349349
address="50 California St." // address
350350
image="50-california-st.jpg"// image
351351
/>
352352
```
353-
```JSX
353+
```js
354354
// In POPOSSpace.js
355355
function POPOSSpace(props) {
356356
// The attributes above set the values of these properties
@@ -372,7 +372,7 @@ You can assign props as key value pairs defined in JSX like attributes in HTML.
372372

373373
You can access props inside a component from the `props` object which is passed as a parameter, like so:
374374

375-
```JSX
375+
```js
376376
function MyComp(props) {
377377
<div>
378378
<h1>{props.message}</h1> // Hello World

P05-Adding-React-Router/content.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ A Route is responsible for displaying components. Routes have a path property: w
3333

3434
In code this might look like:
3535

36-
```JSX
36+
```js
3737
<Router>
3838
<Route path='/home' ... />
3939
<Route path='/about' ... />

0 commit comments

Comments
 (0)