prescottprue / redux-firebasev3

Actions/Reducer with HOC for using redux with Firebase v3
https://redux-firebasev3.firebaseapp.com/
MIT License
36 stars 9 forks source link

Separated/Organized File Structure #8

Closed Bojhan closed 7 years ago

Bojhan commented 8 years ago

This project looks pretty exciting and clean. One of the challenges is having a clear separation between library (this code base) and my own. As reducers, actions and others intermix in the folder structure its hard to keep track.

I am wondering if its a consideration to clearly separate out this library, even if its just about placing everything in source in a nested folder (e.g. source/firebasev3).

https://github.com/davezuko/react-redux-starter-kit/wiki/Fractal-Project-Structure

prescottprue commented 8 years ago

Interesting question! I am familiar with the Fractal Project Structure, but how would that look for changing the library?

Maybe I am misunderstanding, but wouldn't placing everything in a nested folder make it so importing is like this?:

import { reduxFirebase, firebaseStateReducer } from 'redux-firebasev3/firebasev3' 

I kinda like the idea of doing something like this, but not sure if it accomplishes what you are asking for:

import reduxFirebase from 'redux-firebasev3/middleware'
import firebaseStateReducer from 'redux-firebasev3/reducer'

Could you give some possible examples of the import syntax you would like to see? I can try to get this into the v0.1.2 release which will hopefully be sometime today or tomorrow (depending on fixes that will be going into the release).

Bojhan commented 8 years ago

What your are proposing with:

import reduxFirebase from 'redux-firebasev3/middleware
import firebaseStateReducer from 'redux-firebasev3/reducer'

Would be along the lines of what I am thinking. While you can strictly follow the Fractal structure, its more about providing clear overview.

At some point you might also want to separate the functions in the files into separate files about auth, query, etc.

prescottprue commented 8 years ago

@Bojhan Totally agree on the organization of the files within the project. This project was originally based on redux-react-firebase, so I stuck to that folder organization, but I like the idea of changing it up.

It might have to wait until the v0.1.3 version release since v0.1.2 is already getting pretty big. Going to leave this issue open until it is addressed. Anyone can feel free to post suggestions for file/folder structure suggestions in this stream.

prescottprue commented 8 years ago

@Bojhan I have started the file restructure on the v0.1.5 branch including moving the actions like we mentioned. Does it make more sense now or is there more that you would move around?

prescottprue commented 8 years ago

Changes to file structure included in v0.1.5 release.

Leaving this open as a place to discuss future file/folder structure changes.

@Bojhan Thinking about adding a "huge app example" that uses react-redux-starter-kit and illustrates using the library within a fractal pattern. If implementation in that example is unclear, then it will indicate more of a need for files/folders organization change.

Bojhan commented 8 years ago

Thanks!

A huge example would be great.

I think its mostly interesting to see how you pass authentication information like user data down the chain of components in a consistent way. I am currently using the props method in firebase() and connect(), but it feels like a lot of unnecessary nesting.

A work around is {React.cloneElement(this.props.children, { profile: this.props.account })} but that feels quite hacky.

prescottprue commented 7 years ago

@Bojhan this has been addressed in v1.1.1 of react-redux-firebase.