Skip to content

Commit 93c4808

Browse files
committed
added
1 parent dc4332c commit 93c4808

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

docs/data.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"Javascript": {
3+
"introduction": {
4+
"javascript objects" : "javascript objects",
5+
"Prototypal inheritance":"Prototypal inheritance",
6+
"Scoping and hosting":"Scoping and hosting",
7+
"Closures":"Closures",
8+
"JavaScript Higher-Order Functions":"JavaScript Higher-Order Functions",
9+
"The event loop":"The event loop",
10+
"Event bubbling":"Event bubbling",
11+
"Apply, call, and bind":"Apply, call, and bind",
12+
"Callbacks and promises, async/await":"Callbacks and promises, async/await",
13+
"Variable and function hoisting":"Callbacks and promises, async/await",
14+
"Currying":"Currying",
15+
"localstorage":"Currying",
16+
"array fucntions":"Map, filter, reduce , sort of arrays"
17+
},
18+
"design pattern": {
19+
"Decorator" : "Decorator",
20+
"Factory":"Factory",
21+
"Singleton":"Singleton"
22+
}
23+
}
24+
}

src/App.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const markdownFiles = importAll(require.context('../docs', false, /\.md$/))
1212
.sort()
1313
.reverse();
1414

15-
console.log("markdownFiles====>"+markdownFiles);
15+
//console.log("markdownFiles====>"+markdownFiles);
1616

1717
class App extends React.Component {
1818
constructor(props){
@@ -26,13 +26,12 @@ class App extends React.Component {
2626
}
2727

2828
componentDidMount() {
29-
fetch('../docs/SUMMARY.md')
30-
.then((resp) => resp.text())
31-
.then(data => {
32-
this.setState(
33-
{ markdown: data }
34-
);
35-
});
29+
console.log(markdownFiles);
30+
const markdown = Promise.all(markdownFiles.map(
31+
(file) => fetch(file).then((res) => res.text())
32+
)).catch((err) => console.error(err));
33+
34+
this.setState((state) => ({ ...state, markdown }));
3635
}
3736

3837
increment() {

0 commit comments

Comments
 (0)