Update store with props in reactjs - reactjs-flux

I am following flux architecture and I want to know if it is possible to update the store based on the props received ? If yes what is the best method to do so ?

Flux store is responsible for holding the data. The data should be updated by actions.
On the other side, react view components get data from parents by props.
So there is no props for stores!!

Related

How to create html element for each object in collection?

I have String like this:
{"response":{"count":997,"items":[{"id":2943,"first_name":"Vasya","last_name":"Babich","can_access_closed":true,"is_closed":false,"screen_name":"antanubis","track_code":"24fc13d6ZwhuhzyM9V1oRkohiruY-zXeoP1aliqA-1dA4qgxJrQAYSTQYe6kVWsTTKkXWWybQrHU"},{"id":231329886,"first_name":"Vasya","last_name":"Babich","can_access_closed":true,"is_closed":false,"screen_name":"lydka_lydka_lydka","track_code":"a348ab0aAo3CxaTAGsTDu4mpMdBMMjYxgAmOnr7PvUWgaanh141l5NGe_PlLz8a8unX1eOUxXj-GCo6esKk"}]}}
I want to show each value of "items" to user in browser and then user should be able to select one of them and save in database and in his own page in the website. I guess I should use loop and create html element for each item. But how to do this? What data type should I use to manipulate this data and store it?
Thymeleaf is the most widely used view/template engine with Spring Boot and can handle your loop requirement. Spring MVC enables you to manage your app behavior and define the data bound to HTML pages (views). You will need a database and there are lots of options. Check out Spring Data which makes it easy to work with all major database technologies.

Populate Wicket table with Ajax

Is it possible to have 1 input text field that accepts characters from the user, and as the user types, queries to a webservice are launched, and to update the contents of another component dynamicaly with the results of the webservice (which would be a table below the input text)?
If you prefer to use Wicket form controls and Data Table component then you need to make the call to the REST service in your impl of IDataProvider.
Otherwise, as I explained to you earlier today in your other SO post you can do this directly in JS without Wicket. It is a matter of taste and skills.

Square Connect API V2: Partial updates to catalog objects?

In the V2 api, is there a way to partially update a catalog object? For example, if I have an item, and I don't want to keep track of modifier_list_info, it seems I have to send that data with any upserts otherwise it will get wiped out.
Is there a way to specifiy a partial update?
The best way to update a catalog object would be to first retrieve the object (https://docs.connect.squareup.com/api/connect/v2#endpoint-retrievecatalogobject), and then edit the properties you need to change. For instance, the response will have an object field so
response.object.item_data.name = 'Food'
will change the name to 'Food'. Then pass the entire object back to the UpsertCatalogObject endpoint. This will keep all the same properties except for changing the name.

What is the best way to persist data between pages within admin on rest

We have a simple CRUD admin on rest project and with one of our objects, we would like to "Save and create another" with some prefilled in form fields. What is the best way to persist data within AOR?
Right now, I have a solution working using localStorage, but it is not awesome. I have to refresh the 2nd form to have the data prepopulated.
We are thinking about modifying the URL params to include the prefilled form fields, but this seems like a lot of work for something that should be pretty straightforward, particularly within an admin framework.
Thank you in advance!!
The Create component accepts a record prop to setup initial values of the form. This values is merged with the values of the defaultValue prop (can be a function) and values from the admin.record state in redux.
So in your situation the defaultValue prop would allow you to generate the data from the params prop of redux router.

How to improve Angular2 rendering performances when accessing a backend server?

I have a service which is responsible for getting the data from a backend.
The data is shown via a component in its nginit method. It is shown in a table (html table).
I would like to be able to manipulate data without having to reload it each time in my table : ex : delete a row, add a row ... I want all of this very fluid. The data is coming from a database.
So my question is :
Should my service return an observable or an array ?
Is nginit the best place to show my table ?
How should I do things maybe to manage everything in memory? I do not know.
Thanks for any advice.
I would save the data into an array then use lodash to manipulate it.
You could edit, delete, and add rows using lodash's built in functions. When you want to save the data to the backend you would then post the array back to the server. This will keep backend requests to a minimum which will help your performance.
For example you could delete elements from the array using the remove function, https://lodash.com/docs/4.17.4#remove
Lodash can be setup like this https://medium.com/#gtsopour/importing-lodash-into-angular-2-typescript-application-94590365f46d#.9mdcdjnac
Of course you could do this all using raw js though but I find Lodash very rich and easy to use.

Resources