GriddleGriddle / Griddle

Simple Grid Component written in React
http://griddlegriddle.github.io/Griddle/
MIT License
2.5k stars 377 forks source link

Need good example of thrid party plugin not built inside the project. #828

Closed rkralston closed 6 years ago

rkralston commented 6 years ago

Griddle version

^1.13.1

Expected Behavior

Create external plugin that can not only respond to actions, but can fire them.

Actual Behavior

Unknown at this time

Steps to reproduce

Try to build a plugin

Pull request with failing test or storybook story with issue

NA While this step is not necessary, a failing test(s) and/or a storybook story will help us resolve the issue much more easily. Please see the README for more information. https://stackoverflow.com/questions/51772957/have-a-good-griddle-react-plugin-example

I asked the question on SO. I'm reading through the code and will eventually get there on my own. However, my client is not really happy paying me to learn YANAT. Taking the LocalPlugin external would just about solve this for me. I am planning the following as plugins:

The two plugins built internally are good examples of what is needed; however, they import a lot from the Griddle project - specifically the actions for firing those off. I'm experienced with JS, but new to React. What I need may be simple. I just haven't put it together yet. Examples would be greatly appreciated. OTW, I'll run out of time and have to build them inside Griddle - hardly desirable.

Thanks for any help. Love the project. Look forward to a long collaboration.

rkralston commented 6 years ago

Found it. Posted answer on SO.

dahlbyk commented 6 years ago

I added another answer:

Note that in addition to directly accessing the exported selectors and actions, both are available through React Context as well, e.g. in LocalPlugin.components.TableBodyContainer. Context should expose the "best" selectors/actions for the current <Griddle /> after plugins have been applied.

Some work was started in https://github.com/GriddleGriddle/Griddle/pull/743 to make selectors more composable, but the PR has gone stale.

Glad to answer any questions as you embark upon creating your plugins.