8000 Added new exercises · codeguage-code/exercises@6af471f · GitHub
[go: up one dir, main page]

Skip to content

Commit 6af471f

Browse files
Added new exercises
1 parent a149c9a commit 6af471f

File tree

5 files changed

+53
-0
lines changed

5 files changed

+53
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React, { useState } from 'react';
2+
3+
function Counter() {
4+
const [count, setCount] = useState(0);
5+
6+
return (
7+
<div>
8+
<h1>{count}</h1>
9+
<button onClick={() => setCount(0)}>Reset</button>
10+
<button onClick={() => setCount(count + 1)}>Increment (+)</button>
11+
</div>
12+
);
13+
}
14+
15+
export default Counter;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
# A Simple Counter Exercise
3+
4+
Read the exercise's description at [React Foundation — A Simple Counter Exercise](https://www.codeguage.com/courses/react/a-simple-counter-exercise).
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React, { useState } from 'react';
2+
3+
function App() {
4+
const [backgroundColor, setBackgroundColor] = useState('#eee');
5+
6+
return (
7+
<div style={{height: 200, backgroundColor: backgroundColor}}>
8+
onMouseEnter={() => setBackgroundColor('yellow')}
9+
onMouseLeave={() => setBackgroundColor('#eee')}
10+
Change the background
11+
</div>
12+
);
13+
}
14+
15+
export default App;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
# Change The Background Exercise
3+
4+
Read the exercise's description at [React Foundation — Change The Background Exercise](https://www.codeguage.com/courses/react/change-the-background-exercise).

React/1-Foundation/README.md

Lines changed: 15 additions & 0 deletions
3CF5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# React Exercises
2+
3+
In all of the following exercises, each solution file has a default export. It is assumed that this default export is rendered directly via a call to the `render()` method from React DOM.
4+
5+
Here's an illustration, supposing that `App.js` is a solution file:
6+
7+
```jsx
8+
import React from 'react';
9+
import ReactDOM from 'react-dom/client';
10+
import App from './App';
11+
12+
ReactDOM.createRoot(document.querySelector('#root')).render(<App/>);
13+
```
14+
15+
Unless stated otherwise, this will be the default assumption throughout all exercise solution files.

0 commit comments

Comments
 (0)
0