Query Parameters Working on React

The front end React app is now working with query parameters. This meant orchestrating it so that the queries would accept parameters, and deciding where the “state” would exist in my React components. React handles things in a very functional way, where state that involves multiple components should reside in the parent components (which they call owners) and propagated down to the child components (which they call ownees) through properties. State is mutable, properties are immutable. Though this adds complication as you learn and develop, it keeps things organized long term, and you can code with confidence, knowing that the state is only in one spot up what you could call the “ownership tree”. Just as with any React component, when the state in the ultimate owner changes, it renders itself which means re-rendering all of its ownees whose renderings are out of date.

So, with the query parameters as state of the Query component (not the individual Field components our users modify), it keeps all the state in one spot, in the same spot as the code that actually performs the query that uses those parameters, and we now have Query components that should completely take care of rendering themselves and their output in any situation in our React app.

It’s still completely unstyled, so my work will now be to style it and prepare it for when we begin linking it to production data soon.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s