Dams
Dams

Reputation: 13

Is it possible to develop a reusable react/redux project?

I would like to know if it is possible to create a React project containing Redux library and then export it in another project? Until now, I only create components that display data. So I never wonder if it is possible.

The goal is to develop a little chatbot that communicates with an API. Then, this project will be used in several React projects.

Is it possible to do this? If yes, is it a good practice?

I have searched on the web and on Stack Overflowbut I didn't find any answer. Sorry if the question has already been asked.

Thanks.

Upvotes: 1

Views: 152

Answers (1)

It is possible. A React component is a JavaScript function or a class. It can contain any JavaScript code. So a companent that is exported to other projects can manage its state using Redux. Redux makes sense when the state handling is complex. Your component seems simple since all it does send data to an API and show received data. If you think it is complicated and that it would be difficult to implement it using pure React alone, you can use Redux.

Upvotes: 1

Related Questions