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
React with Redux Challenges #4
Comments
The pre-requisite for this section would be React ( #2 ) and Redux ( #3 ). Here's a rough outline prepared by @EliBei
|
Create a
|
Create a
|
Create a
|
Rendering
|
@alayek wow - you are off to a great start with these challenges. Great job making these project-oriented, so they involve gradually layering on functionality. I can't wait to work through these and learn Redux myself! :) |
Mostly @EliBei has done the heavy-lifting. I am merely reviewing the challenges and adding them in order. |
Create
|
Bind
|
Passing down event handlers to formChallenge Description
Instructions
Note
Challenge Seed import React, { Component } from 'react';
import GroceryForm from './GroceryForm';
import GroceryList from './GroceryList';
export default class GroceryPage extends Component {
constructor(){
super();
this.state = {
input: {value: ''},
list: []
};
this.onChange = this.onChange.bind(this);
this.onSubmit = this.onSubmit.bind(this);
}
onChange(event){
const input = this.state.input;
input.value = event.target.value;
this.setState({input:input});
}
onSubmit(){
const list = this.state.list;
const input = this.state.input;
const newList = list.concat([input.trim()])
input.value = '';
this.setState({list:list,input:input});
}
render() {
return (
<div>
<GroceryForm value={this.state.input.value} valueChange={this.onChange} formSubmit={this.onSubmit}/>
<GroceryList />
</div>
);
}
} import React, { Component } from 'react';
export default class GroceryForm extends Component {
constructor(props) {
super();
}
render() {
return (
<div>
<h1>Add Grocery Item</h1>
{/* Change code below */}
<input type="text" name="item" value={value}/>
<input type="submit" value="Submit" />
{/* Change code above */}
</div>
)
}
} Challenge Tests // TODO Challenge Solution import React, { Component } from 'react';
import GroceryForm from './GroceryForm';
import GroceryList from './GroceryList';
export default class GroceryPage extends Component {
constructor(){
super();
this.state = {
input: {value: ''},
list: []
};
this.onChange = this.onChange.bind(this);
this.onSubmit = this.onSubmit.bind(this);
}
onChange(event){
const input = this.state.input;
input.value = event.target.value;
this.setState({input:input});
}
onSubmit(){
const list = this.state.list;
const input = this.state.input;
const newList = list.concat([input.trim()])
input.value = '';
this.setState({list:list,input:input});
}
render() {
return (
<div>
<GroceryForm />
<GroceryList />
</div>
);
}
} import React, { Component } from 'react';
export default class GroceryForm extends Component {
constructor(props) {
super();
}
render() {
return (
<div>
<h1>Add Grocery Item</h1>
{/* Change code below */}
<input type="text" name="item" value={value} onClick={this.props.valueChange}/>
<input type="submit" value="Submit" onSubmit={this.props.formSubmit} />
{/* Change code above */}
</div>
)
}
} |
Passing down List to
|
@alayek this is also off to a great start! Keep it up. Let me know if I can do anything to help. I can help you find someone else who's good with React if you want 😄 |
@QuincyLarson that would be great! I really could use some help with this. I was thinking first few problems can be simply moved to React. Because they use only React concepts, and nothing about a state containers. But we have the challenges ready (thanks to @EliBei ), and I will submit the rest of them here soon. |
@alayek sure - we can look into redistributing the challenges once we get them done. The main thing is we need to get this Enzyme library working ASAP so we can create tests properly. |
Does this still need some help? It'd be my first open source adventure, but I've got a good handle on react-redux and could make the challenges. |
@mmhansen, yeah defiantly! |
Allright. I'll just try to follow alayek's example. It looks like you guys use enzyme for testing, right? |
Validate Props with React.PropTypesChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
Is the quality okay? |
Looks good to me 😃 |
Make your first actionChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
I'm changing the action challenges a little bit.
|
Make your first action creatorChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
|
Type constants and exporting action creatorsChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
|
@atjonathan I changed it to 'note'. |
@mmhansen 😂 👍 |
Create a reducerChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
|
Create a VALUE_CHANGE reducerChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
|
Create a FORM_SUBMIT reducerChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
|
Creating a root reducerChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
|
@mmhansen awesome work. These look great so far! Just curious - why is the {/* Change code below */} wrapped in curly braces? |
@QuincyLarson oops. I just had that copied from the jsx sections, but we don't need it anymore in the redux parts. Thanks for the good eye. 👍 |
Creating a storeChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
|
Using middlewaresChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
|
Setup ProviderChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
|
Using connectChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
|
mapStateToPropsChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
|
Adding actions to connectChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
|
Remove Component StateChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
|
Bind action creatorsChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
|
Create 'REMOVE_GROCERY' actionChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
|
Create 'REMOVE_GROCERY' reducerChallenge Description
Instructions
Tips
Challenge Seed
Challenge Solution
|
Combining reducersChallenge Description
Instructions
TipsChallenge Seed
Challenge Solution
|
Checklist
|
@ALL Please see the React Issues thread about an update we've made to the development of these React/Redux challenges. |
Thanks everyone! I'm closing this thread because our alpha React + Redux challenges are live. Read about them here: https://forum.freecodecamp.com/t/alpha-of-free-code-camps-react-redux-challenges-is-now-live/64492 |
@alayek is in charge of coordinating the creation of these challenges.
Here are the challenges we have currently planned:
For each challenge, please reply to this GitHub issue with:
The text was updated successfully, but these errors were encountered: