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

Logic behind components (multiple states, store,...???) / Page Assembly #138

Closed
mar-bi opened this issue Dec 25, 2017 · 13 comments
Closed

Comments

@mar-bi
Copy link
Contributor

mar-bi commented Dec 25, 2017

Guys, I guess we are at the point where we need to discuss the overall strategy for:

  • handling state of components (some of them are forms, buttons, inputs,...)
    They need to handle events, control inputs, request data.

For now I have 2 options: multiple states or redux.

  • pages / how we will assemble them
  1. enclose everything in components. Page is going to be tidy:
import React from 'react'
import Hero from '../layouts/components/Hero'
import JobsContainer from '../layouts/components/JobsContainer'

const JobsPage = () => (
  <div>
    <Hero type="jobs" />
    <JobsContainer />
  </div>
)

export default JobsPage
  1. build on the page
  2. mix of 1 and 2 (according to the situation)

This is the discussion, please comment. 💬

@spences10
Copy link
Collaborator

I vote redux

@mar-bi
Copy link
Contributor Author

mar-bi commented Dec 25, 2017

I'm for Redux too. 👍
However, I haven't try it out of the tutorial apps.
☺😆

@spences10
Copy link
Collaborator

spences10 commented Dec 25, 2017

Nope, me neither 🙃

https://egghead.io/courses/getting-started-with-redux

I've part watched this 👆

@mar-bi
Copy link
Contributor Author

mar-bi commented Dec 25, 2017

I built Reduxstagram with Wes Bos's course: Learn Redux on Youtube. 👷‍♂️

@spences10
Copy link
Collaborator

Ha yes me too, that was a great course, I couldn't use it for a demo for some reason on now though

@mar-bi
Copy link
Contributor Author

mar-bi commented Dec 26, 2017

@miljan-fsd suggested a very interesting article about alternatives to Redux.

After reading it + some additional reading i tend to use mobx.

My reasons: I don't have much experience with Redux, especially with managing async requests (third-party API, DB). As I know async requests require extra packages like redux-saga.

Instead I can get all this (i hope) with mobx.

On the other hand, If we have in our team a Redux professional or volunteer who takes the task of managing the app state with Redux, I agree 🙃

@mar-bi
Copy link
Contributor Author

mar-bi commented Jan 5, 2018

Guys, are there any ideas about handling state? Redux, mobX?

Let me describe our current state with the app state:

  • now it lives in 2 container components: JobsContainer and CoursesContainer (I followed react best practices and kept the state in a container component). They have a very similar structure.
  • the states of these components has 2 patterns of usage:
    1. static, no mutations, for rendering of children
    2. dynamic, with mutations (search and filter queries, fetching data from API (fakeAPI for now))

As I understand now, the static piece of state we can move to gatsby-config.js adding to siteMetadata and then query from the layout (not components!!!) or pages with graphQl.

The dynamic piece of state we can move to a store. The question now is what is better to choose Redux, mobX, something else, or keep in the containers. 🤔

Please share with me your opinions. ❓ 🆘
Thank you.

@spences10
Copy link
Collaborator

Apollo

@mar-bi mar-bi added the backlog label Jan 9, 2018
@spences10
Copy link
Collaborator

Apparently, Apollo will be the much more user-friendly one to use, if Wes and Scott are anything to go by 😄

https://syntax.fm/show/027/graphql-here-is-what-you-need-to-know

@mar-bi
Copy link
Contributor Author

mar-bi commented Jan 14, 2018

Definitely, we are going with Apollo 💯
We highly appreciate the opinions of Wes and Scott. 🥇 🙃

@spences10
Copy link
Collaborator

Yeah, I love the way those guys explain things

Ok, so we're agreed on Apollo, we need to educate ourselves on it now, I guess 😁

I'm currently looking at how Gatsby does data then I'll go onto Apollo, I guess

@mar-bi
Copy link
Contributor Author

mar-bi commented Feb 27, 2018

continues in #224

@mar-bi mar-bi added next and removed backlog labels Mar 3, 2018
@mar-bi
Copy link
Contributor Author

mar-bi commented Mar 4, 2018

app state is managed by apollo-link-state (instead of Redux`)
closed by #132

@mar-bi mar-bi closed this as completed Mar 4, 2018
@ghost ghost removed the next label Mar 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants