Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update Chapter07/basic-linking/src/Second.tsx & add-article-component… #104

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Chapter05/add-article-component/src/AddArticle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ function AddArticle({
onClickAdd,
}) {
return (
<section>
<header>
<h1>{name}</h1>
<input placeholder="Title" value={title} onChange={onChangeTitle} />
<input placeholder="Summary" value={summary} onChange={onChangeSummary} />
<button onClick={onClickAdd}>Add</button>
</section>
</header>
);
}

Expand Down
19 changes: 9 additions & 10 deletions Chapter05/add-article-component/src/MyFeature.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from "react";
import ArticleList from "./ArticleList";
import AddArticle from "./AddArticle";

const id = (function* () {
let i = 1;
Expand Down Expand Up @@ -55,16 +56,14 @@ function MyFeature() {

return (
<section>
<header>
<h1>Articles</h1>
<input placeholder="Title" value={title} onChange={onChangeTitle} />
<input
placeholder="Summary"
value={summary}
onChange={onChangeSummary}
/>
<button onClick={onClickAdd}>Add</button>
</header>
<AddArticle
name="Articles"
title={title}
summary={summary}
onChangeTitle={onChangeTitle}
onChangeSummary={onChangeSummary}
onClickAdd={onClickAdd}
/>
<ArticleList articles={articles} onClickRemove={onClickRemove} />
</section>
);
Expand Down
19 changes: 10 additions & 9 deletions Chapter05/article-item-component/src/MyFeature.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from "react";
import ArticleList from "./ArticleList";
import AddArticle from "./AddArticle";

const id = (function* () {
let i = 1;
Expand Down Expand Up @@ -56,14 +55,16 @@ function MyFeature() {

return (
<section>
<AddArticle
name="Articles"
title={title}
summary={summary}
onChangeTitle={onChangeTitle}
onChangeSummary={onChangeSummary}
onClickAdd={onClickAdd}
/>
<header>
<h1>Articles</h1>
<input placeholder="Title" value={title} onChange={onChangeTitle} />
<input
placeholder="Summary"
value={summary}
onChange={onChangeSummary}
/>
<button onClick={onClickAdd}>Add</button>
</header>
<ArticleList articles={articles} onClickRemove={onClickRemove} />
</section>
);
Expand Down
4 changes: 2 additions & 2 deletions Chapter07/basic-linking/src/Second.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function First() {
function Second() {
return <h1>Second</h1>;
}

export default First;
export default Second;