Giter Site home page Giter Site logo

nyt-react-3's Introduction

NYT Mongo Scrubber

NYT Mongo Scrubber

Object

This scrubber lets users choose a topic, narrow the results with specified years, and save articles of interest. They can add notes to their saved articles or delete them too.

Technology used

This scrubber uses React for the V of its MVC; it will also have a Mongo database. Additional technologies include Axios for the form to talk with React; JavaScript, Express and Yarn for package management.

Code excerpts

I'm told React simplifies things, but I have to respectfully disagree. For example it takes all of this to get ONE form field functioning:

in the form component .js file (there's still the index and css files that aren't included here):

const Form = props => {

return (
<form>
<label htmlFor="topic">Topic</label>
<input 
placeholder="example topic"
type="text"
className="form-input"
id="topic"
required
onChange={ props.handleInputChange }
value={props.value}
></input>
</form>
)
}

export default Form;

in the Pages/home file:

class App extends Component {
constructor (props){
super(props)
}
state = {
topic: ""
}
handleInputChange=(e) =>{
console.log(e)
this.setState({
topic: e.target.value
})
}
handleSubmit=() =>{
console.log(this.state.topic)
axios.post(`/test`, { topic:this.state.topic })
.then(res => {
console.log(res);
console.log(res.data);
})
}
//invoked to load component data
componentDidMount() {
}

And don't forget this part in the wrapper:

<Form 
handleInputChange={this.handleInputChange}
{...this.props}
value={this.state.topic}
/>
<Button 
className="search" 
onClick={this.handleSubmit}
>

Conclusions

I didn't get as far as I wanted with this app yet. But I learned more about React and do plan to get it working; it just may not happen before July 12 :neckbeard:

nyt-react-3's People

Contributors

green64 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.